Hello,

After Matthew pointed out that Transcript>>show: isn't tread-safe, I changed
it to Transcript>>nextPutAll:

The script still wasn't give the expected output. So after playing around a
bit, I discovered if I waited just a bit before flushing it would then
work.  It feels like a hack though.

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

[Transcript cr; nextPutAll: 'b1'. semB signal. semA wait.
        Transcript cr; nextPutAll: 'b2'. ] fork.
[Transcript cr; nextPutAll: 'a1'. semA signal. semB wait.
        Transcript cr; nextPutAll: 'a2'.] fork.
(Delay forMilliseconds: 1) wait.
Transcript flush

Results:

b1 a1 a2 b2

It's kind of strange why this only seems to bite me. :/

Thanks for the help,
  JTS
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to