<br><br><div class="gmail_quote">On Dec 21, 2007 8:09 AM, Igor Stasenko &lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On 20/12/2007, Tom Phoenix &lt;<a href="mailto:rootbeer@redcat.com">rootbeer@redcat.com</a>&gt; wrote:<br>&gt; On 12/20/07, Igor Stasenko &lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt; wrote:
<br>&gt;<br>&gt; &gt; This is essentially useful when you need to guarantee that process<br>&gt; &gt; will stay suspended even if it&#39;s currently suspended waiting for<br>&gt; &gt; semaphore signal.<br>&gt;<br>&gt; Do you mean to say that your processes resume running before their
<br>&gt; semaphores are signaled?<br>&gt;<br><br></div>Just try to run given code:<br><br>| sema proc |<br>sema := Semaphore new.<br>proc := [ sema critical: [ Transcript show: &#39;Oopsie&#39; ] ] fork.<br>Processor yield.
<br>proc suspend.<br>proc resume.<br><div><div class="Wj3C7c"></div></div></blockquote><div><br>This code looks wrong.<br><br>I think what you want is:<br><br>sema := Semaphore new.<br>proc := [ sema wait. Transcript show: &#39;Oopsie&#39;. ] fork.
<br>proc suspend.<br>sema signal.<br>proc resume.<br><br>I can&#39;t try this code at the moment - I don&#39;t have Squeak nearby.<br><br>Generally, I&#39;d rarely use Process&gt;&gt;suspend in my code. Semaphores provide the behaviour that you want; a Semaphore is a linked list of waiting processes. When you call #wait on a semaphore, your process gets added to the list. When you call #signal, the process at one of the ends of the list (FIFO? LIFO? Can&#39;t remember) gets resumed. The effect of #suspend and #resume should have no effect on the signalled/waiting state of a Process.
<br><br>In the Launcher example that you give, it would be okay to use #suspend and #resume, but there shouldn&#39;t be anything else in the image which is trying to suspend or resume those processes. <br><br>Gulik.<br></div>
</div><br><br clear="all"><br>-- <br><a href="http://people.squeakfoundation.org/person/mikevdg">http://people.squeakfoundation.org/person/mikevdg</a><br><a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a>