Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^7: Threading in a loop

by Anonymous Monk
on Apr 22, 2013 at 15:09 UTC ( #1029903=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Threading in a loop
in thread Threading in a loop

Trying to synchronize threads by creating large numbers of threads with small scope is probably not the way to go.

You code above has the added disadvantage of possibly printing some values twice while skipping a value later on.

Wise synchronization of threads will usually involve either queues or semaphores. Feel free to look into Thread::Queue or Thread::Semaphore for implementation details.


Comment on Re^7: Threading in a loop

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2015-07-31 16:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls