Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Module for transparently forking a sub?

by BrowserUk (Patriarch)
on Feb 13, 2009 at 22:06 UTC ( [id://743721]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Module for transparently forking a sub?
in thread Module for transparently forking a sub?

If I wind up writing one, maybe I could steal the interface from threads for it.

That already exists, but it just as vulnerable to thread-safety problems as ithreads--eg. you probably won't be able to run concurrent DB queries safely; and if you're lucky enough to find thread-safe drivers, concurrent queries will likely not run any quicker than they do serially. And it is not a cross-platform solution; threads is!

And for passing back complex data structures, serialising them through a pipe is far slower that using shared memory.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^3: Module for transparently forking a sub?

Replies are listed 'Best First'.
Re^4: Module for transparently forking a sub?
by kyle (Abbot) on Feb 13, 2009 at 22:12 UTC

    I don't think I understand your reply, so I'm wondering if I wasn't clear.

    What I meant was that if I write a module like the one I was looking for (which does with fork what you demonstrate with threads), I could use methods with the same names and calling conventions as threads (e.g., Foo->create( { context => 'list' }, \&foo ), $child->is_running(), etc.). The interface already defined for it looks nicer than what I had in mind before I read about it. Using it would also mean that someone who becomes familiar with one will have an easier time switching over to using the other one if circumstances warrant it.

        Yes! That's what I was looking for all along! Thank you!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-23 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found