in reply to Re^3: multi-threaded questions
in thread multi-threaded questions

Thanks for your response. I dont even want to pass data to the other threads - I just want them to start moving at the calling of the first threads.

Does the code need to change at all if looped as the original example suggests?

Brian

Replies are listed 'Best First'.
Re^5: multi-threaded questions
by renodino (Curate) on Dec 08, 2006 at 22:08 UTC
    I don't really know what your "example suggests", but I'll assume you mean you want a persistent daemon that spins on the tests, and fires off a msg to the subordinate threads when there's work to do. One issue: your text describes 30 master threads dispatching to 30 worker threads. Does that mean the master thread only dispatches a single worker thread, or dispatches to all 30 ? If the former, your code is OK (assuming you move the enqueue() inside the loop). If the latter, you've got some challenges, and may find Thread::Queue::Multiplex useful.

    Also, while your Thread::Queue use is a convenient solution, you may find Thread::Semaphore a more "CompSci"-ish solution, and maybe apply the recent addition of inter-thread signalling, assuming you're using a shiny new version of the threads module.


    Perl Contrarian & SQL fanboy