<?xml version="1.0" encoding="windows-1252"?>
<node id="905370" title="Re^6: AnyEvent: How to protect critical sections?" created="2011-05-17 17:25:46" updated="2011-05-17 17:25:46">
<type id="11">
note</type>
<author id="325183">
saintmike</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;This cannot work - if you expect -&gt;lock() to block until the semaphore is released, how can it continue to execute the remaining code elsewhere?&lt;/i&gt;&lt;/blockquote&gt;

The same way that $condvar-&gt;recv() blocks and lets code run elsewhere. 
&lt;p&gt;
Only problem: $condvar-&gt;recv() cannot be called from within a callback, according to the AnyEvent docs:
&lt;p&gt;
&lt;i&gt;
"Note that doing a blocking wait in a callback is not supported by any event loop, that is, recursive invocation of a blocking "-&gt;recv" is not allowed,".&lt;/i&gt;

</field>
<field name="root_node">
905330</field>
<field name="parent_node">
905367</field>
</data>
</node>
