Perl Monk, Perl Meditation | |
PerlMonks |
Re^6: AnyEvent: How to protect critical sections?by saintmike (Vicar) |
on May 17, 2011 at 21:25 UTC ( [id://905370]=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?The same way that $condvar->recv() blocks and lets code run elsewhere. Only problem: $condvar->recv() cannot be called from within a callback, according to the AnyEvent docs: "Note that doing a blocking wait in a callback is not supported by any event loop, that is, recursive invocation of a blocking "->recv" is not allowed,".
In Section
Seekers of Perl Wisdom
|
|