Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Boolean Thread::Semaphore ?by BrowserUk (Patriarch) |
on Feb 08, 2012 at 12:14 UTC ( [id://952473]=note: print w/replies, xml ) | Need Help?? |
Is there a way of using Thread::Semaphore in this way, or an alternative semaphore module that can be used for this purpose? You don't want a semaphore. The simplest mechanism is:
If you are concerned that the queue might empty during that 1 second, use Time::HiRes::usleep(). If you really insist on not polling the queuesize, then use a condition vatiable:
But really, the latter involves more work and is less effective. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|