in reply to Module for transparently forking a sub?

Why don't you just use threads, which gives you the convenient thing to run code in parallel yet even receive the results without serializing them to disk or other IPC?

  • Comment on Re: Module for transparently forking a sub?

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

    Basically, I don't know much about threads. My hazy impression of threads is that they offer little over forking and that it's hard to share a complex data structure with them. If that's not true, maybe using threads would make this all trivial, and I should just learn that.

      The sharing problems only arise if you actually try to use the same data structure concurrently from two or more threads. If you simply pass off parameters to a subroutine, or to a worker thread using Thread::Queue, you don't have much of a problem. And returning the information (say, again, via a queue) is easy too.