Lukas Renggli wrote:
I've also noticed that Process>>isTerminated is not thread-safe...
And #signalException:
Good one. Yes, this needs fixing. My suggestion would be (with the other changes):
signalException: anException | oldList | self isActiveProcess ifTrue: [^anException signal].
"Suspend myself first to ensure that I won't run away in the midst of the following modifications." oldList := self suspend.
"Add a new method context to the stack that will signal the exception" suspendedContext := MethodContext sender: suspendedContext receiver: self method: (self class lookupSelector: #pvtSignal:list:) arguments: (Array with: anException with: oldList).
"If we were on a list to run, then suspend and restart the receiver (this lets the receiver run if it is currently blocked on a semaphore). If we are not on a list to be run (i.e. this process is suspended), then when the process is resumed, it will signal the exception"
oldList ifNotNil: [self resume].
Cheers, - Andreas