Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Explicit thread context

by jdhedden (Deacon)
on May 23, 2006 at 17:24 UTC ( [id://551209]=note: print w/replies, xml ) Need Help??


in reply to Re: Explicit thread context
in thread Explicit thread context

I do have to wonder at the need for two separate interfaces though?
thread->create( { context => 'list' }, ...
# -v-
thread->create( { list => 1 }, ...
The short answer is flexibility. The former is more descriptive; the latter more succinct. Use the style which suits you best.
What context results from this?
threads->create( { scalar => 1, void => 1, context => list, list => 0 }, ...
The official answer would be The behavior is unspecified. The technical answer is that the code checks for context first, and would then ignore anything else.
My main objection is the effect on performance.
...
The additional complexity of parsing and validating the dual interface comes at a critical point in those applications that are most likely to make most use of them.
At most, the penalty is a few exists calls (1 for context which is first in the code, up to 4 in the case of void which comes last), plus a hash fetch. Further, this feature is implemented entirely in XS code, and so is quite fast.

Additionally, if this feature is not used, there is no performance penalty. Therefore, if your code is really that super sensitive to response, don't use it.


Remember: There's always one more bug.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://551209]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found