Syntactic Confectionery Delight | |
PerlMonks |
Re^5: AnyEvent: How to protect critical sections?by Corion (Patriarch) |
on May 17, 2011 at 21:03 UTC ( [id://905367]=note: print w/replies, xml ) | Need Help?? |
This cannot work - if you expect ->lock() to block until the semaphore is released, how can it continue to execute the remaining code elsewhere? I would either use a plain boolean variable, like you did in your first case, and keep the timer running:
... or manually restart the timer when it's allowed to restart again. The guard values returned from creating a timer allow you to conveniently stop a timer.
In Section
Seekers of Perl Wisdom
|
|