<br><br><div class="gmail_quote">On Mon, Oct 22, 2012 at 2:17 AM, Clément Bera <span dir="ltr">&lt;<a href="mailto:clement.bera@inria.fr" target="_blank">clement.bera@inria.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br><br>I don&#39;t understand something on BlockClosure&gt;&gt;ensure:. Why does it use &#39;self valueNoContextSwitch&#39;  and not &#39;self value&#39; ? In which case is there an issue ? </blockquote><div><br></div>
<div>Prior to my closure implementation BlockContext&gt;&gt;value[:value:*] was not a context switch point.  So to preserve the threading semantics of ensure: we implemented ensure: in terms of BlockClosure&gt;&gt;valueNoContextSwitch, which is not a context-switch point, as opposed to BlockClosure&gt;&gt;value[:value:*].  The context switch points in the VM are non-primitive sends (or failing primitives, i.e. full method activation), backward branches, the Process primitives suspend, resume, signal and wait (and CrtiticalSection/Mutex enter and exit) and block evaluation.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>Thank you for any answers<br>

<br>BlockClosure&gt;&gt;ensure: is implemented this way :<br><br>ensure: aBlock<br>        &quot;Evaluate a termination block after evaluating the receiver, regardless of<br>         whether the receiver&#39;s evaluation completes.  N.B.  This method is *not*<br>


         implemented as a primitive.  Primitive 198 always fails.  The VM uses prim<br>         198 in a context&#39;s method as the mark for an ensure:/ifCurtailed: activation.&quot;<br><br>        | complete returnValue |<br>        &lt;primitive: 198&gt;<br>


        returnValue := <b>self valueNoContextSwitch</b>.<br>        complete ifNil:[<br>                complete := true.<br>                aBlock value.<br>        ].<br>        ^ returnValue<br><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>