No such thing as a small change | |
PerlMonks |
Re: Reusable threads demoby JoeKamel (Acolyte) |
on Aug 19, 2008 at 19:32 UTC ( [id://705317]=note: print w/replies, xml ) | Need Help?? |
Zentara,
Sorry to be "that guy", but you gave me the power, and with great power....should come jelly beans...or something like that. Anyway, depending on what folks do with this code, there is a potential infinite loop here:
if you have enough threads that this loop isn't finished by the time the earliest threads are starting, then the worker will push threads back into the @ready list. In my case (as i just found out), it takes about ~130 threads to get to this point. Granted, in this example the loop will be done soon since the to be processed list is pretty short, but depending on what folks do with your example, this may not be the case. So, this probably isn't a general problem, but still. Luckily, its easily solved (otherwise I'd be asking questions again). change the init loop to look like:
Hopefully this will be useful to the next madman that comes along
In Section
Meditations
|
|