barvin has asked for the wisdom of the Perl Monks concerning the following question:
As the loop runs each call to job goes to a different thread until 5 threads are used, and then the loop waits until a thread becomes available. When a thread is available the loop uses it etc...$pool = Pool::Of::Threads->new(how_many_threads => 5); for (1 .. 1000) { $pool->job({sleep 5; print ($_: I'm in the thread}); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Building a thread pool
by BrowserUk (Patriarch) on Apr 18, 2006 at 13:12 UTC | |
|
Re: Building a thread pool
by zentara (Cardinal) on Apr 18, 2006 at 11:55 UTC | |
|
Re: Building a thread pool
by barvin (Beadle) on Apr 18, 2006 at 03:08 UTC | |
by BrowserUk (Patriarch) on Apr 18, 2006 at 09:10 UTC | |
by benizi (Hermit) on Apr 18, 2006 at 18:15 UTC | |
by BrowserUk (Patriarch) on Apr 18, 2006 at 18:30 UTC | |
by benizi (Hermit) on Apr 18, 2006 at 19:13 UTC | |
|
Re: Building a thread pool
by superfrink (Curate) on Apr 18, 2006 at 03:46 UTC | |
|
Re: Building a thread pool
by barvin (Beadle) on Apr 18, 2006 at 21:41 UTC |