The timeout is 10. A thread may sleep from 5 to 15 seconds. So some will end before getting killed.
Also, the timer thread does not know how long the sleep value in a thread is. Again, this is an example of pooling. Obviously, a thread that just sleeps is useless. The WORK section might do DB or web searches. In that case, you end result would be the main thread getting whatever results had been obtained during the timeout period. On Thu, Dec 13, 2012 at 12:15 PM, Alfonso Caponi <alfonso.cap...@gmail.com>wrote: > Hi list, > > I've a question about pool example script ( > http://cpansearch.perl.org/src/JDHEDDEN/threads-1.86/examples/pool.pl). > > Theoretically, should the sub "timer" kill threads immediately when sleep > value is greater than timeout value? > At the moment seems that the threads wait for the sleep value than they got > killed by sub "timer". > > Thank you >