in reply to Re: Boolean Thread::Semaphore ?
in thread Boolean Thread::Semaphore ?
You don't want a semaphore.
The simplest mechanism is:
while( my $workitem = sourceOfWork() ) { sleep 1 while $Q->pending > MAXQ; $Q->enqueue( $workitem ); }
Thanks, that looks to be a much more sensible approach compared with what I was doing with semaphores.
That should teach me to read algorithoms online that are intened for other languages or problem domains where near realtime responses are required.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Boolean Thread::Semaphore ?
by mellon85 (Monk) on Feb 08, 2012 at 17:28 UTC | |
by BrowserUk (Patriarch) on Feb 08, 2012 at 19:00 UTC |