develooper Front page | perl.ithreads | Postings from December 2012

Re: pool example

Thread Previous
From:
Jerry D. Hedden
Date:
December 13, 2012 17:35
Subject:
Re: pool example
Message ID:
CABcAEYyL+VwWGLGQ2nkbYF-ND-qLHrOytUb0LSVa=Q1498zreg@mail.gmail.com
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.caponi@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
>

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About