This is probably a safer version.  It works for me.

semA := Semaphore new.
semB := Semaphore new.

thread1 := [Transcript cr; nextPutAll: 'b1'. semB signal. semA wait.
        Transcript cr; nextPutAll: 'b2'. ] fork.
thread2 := [Transcript cr; nextPutAll: 'a1'. semA signal. semB wait.
        Transcript cr; nextPutAll: 'a2'.] fork.

[thread1 isTerminated and: [thread2 isTerminated]] whileFalse:
    [(Delay forMilliseconds: 100) wait].
Transcript flush

Now to move on to another pattern.

JTS
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to