|
Re: Semaphore problems: msg#00146lang.smalltalk.squeak.beginners
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@xxxxxxxxxxxxxxxxxxxxxxxxxx http://lists.squeakfoundation.org/mailman/listinfo/beginners
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Semaphore problems, Jason Shoemaker |
|---|---|
| Next by Date: | Re: Semaphore problems, Jason Shoemaker |
| Previous by Thread: | Re: Semaphore problems, Jason Shoemaker |
| Next by Thread: | Re: Semaphore problems, Jason Shoemaker |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |