gohu at rocketmail.com
Mon Sep 3 10:16:06 UTC 2001
--- Mark van Gulik <ghoul6 at home.com> wrote:
> I believe your code is incorrect. Does Squeak use a termination
Could have guessed! :-)
> exception to safely kill processes? If not, ignore the ramblings of a
> lunatic. If so, a window exists between the #wait and the #ensure:
> (right between the two statements). If the process is terminated in
> that window, the semaphore is not released. I have patched this in
> VisualWorks (same problem), but the makes use of some interesting
> conjectures about the VisualWorks jitter.
> If you like, you can use my test:
> 100 timesRepeat: [
> | s procs |
> s := Semaphore forMutualExclusion.
> procs := (1 to: 50) collect: [:i |
> [Processor yield. [s critical: ] repeat] forkAt: Processor
> activeProcess priority - 1].
> procs do: [:p |
> (Delay forMilliseconds: 2) wait.
> p terminate].
> (Delay forMilliseconds: 100) wait.
> s excessSignals = 0 ifTrue: [self error: 'Failure to release critical
So... you mean this should work with the original #critical:?
And, I do not really understand your check for failure, if it works shouldn't excessSignals be 0?
I have obviously not been coding too much with Semaphores...
Göran Hultgren, goran.hultgren at bluefish.se
GSM: +46 70 3933950, http://www.bluefish.se
"Department of Redundancy department." -- ThinkGeek
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
More information about the Squeak-dev