<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12-08-14 3:24 PM, patrick dudjalija
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAEMqm6GttreSY5i+SA=Hg1=C8sAszQOu63miV_R5cfAW5a77Sw@mail.gmail.com"
      type="cite">
      <pre wrap="">Hi everybody !

I'm developing an educative game.
I've written a "gameEngine" class which does the logic for the general
progression in the game : switching between instances of morph
subclasses which implement intro screen / mini-games/levels / end
screen etc ...

Now, i need to synchronize the instance of the gameEngine class with
the instances of the other classes.
Example : once the gameEngine starts the instance of a morph subclass
which implements a mini-game, it must sleep until the mini-game is
finished, and then wake up and does further required switching (next
mini-game or intro screen or end screen ...).

i thought that a "simple" semaphore would quickly give a solution to
the problem.
But i get a freezed code.

I've modelized/simplified the problem with the following workspace code.
See also fileout of Class TestSynchro as attachment.
TestSynchro has a step method which prints some lines to Transcript,
then calls the method stopStepping and signal to the semaphore.
The workspace code does a wait, before printing to Transcript 'Hello World'!

Problem is that the code freezes , on the line code -&gt; sem wait
I first thought that the code freezed because in the same process. And
added a fork to the block which creates instance of TestSynchro. But
it does'nt help ...

Any help will be appreciated !
Thanks by ad2vance,

Patrick Dudjalija



|ts sem|

sem:=Semaphore new.

[ts:= TestSynchro new.
ts semaphore:sem.
ts openInWorld.
ts start.] fork.

sem wait.
Transcript cr; show:'Hello world !';cr.
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
<a class="moz-txt-link-freetext" href="http://stephane.ducasse.free.fr/FreeBooks/GuzdialBookDrafts/BuildUI-ch5.pdf">http://stephane.ducasse.free.fr/FreeBooks/GuzdialBookDrafts/BuildUI-ch5.pdf</a><br>
    <br>
    I don't know much about this stuff, but using Semaphore for
    animations seems too low level. Pg. 53 of this pdf describes how
    step and stepTime work. <br>
    <br>
    HTH,<br>
    Chris <br>
    <br>
    <br>
    <br>
  </body>
</html>