More Delay/Semaphore "fun"

Paolo Bonzini bonzini at gnu.org
Sun Oct 7 20:46:20 UTC 2007


> Hm ... it looks wrong to me unless there is a part which isn't shown 
> here or GST works differently. In Squeak, when the semaphore gets 
> signaled, the process gets transferred from the semaphore to one of 
> Processor's suspendedList.

If the suspendedList is one of the processor's, ex semaphore is nil.
That's part of how the ProcessBeingTerminated is built in
Process>>#terminate.

> I would really expect that code above to to test for "ex semaphore == 
> self" instead of nil, which would make a lot more sense to me.

Yes, it would be okay too.

> Also, how 
> do you ensure atomicity in the operation when you manipulate the 
> suspendingList itself?

I don't understand really, but the atomicity of some operations (for
example #queueInterrupt:, which is the same as in VisualAge and is how
the ProcessBeingTerminated exception is sent to the process) is
guaranteed by telling the VM to disable preemption.

Plus, as in ST-80 (Blue Book) and Squeak, no interruption can happen
between "caught := true" and "self wait" because of when interrupts
are tested for.

Paolo



More information about the Squeak-dev mailing list