Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 musing on the Monastery: (7)
As of 2014-09-15 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (147 votes), past polls