'From Squeak6.0rc1 of 24 June 2022 [latest update: #22077] on 27 June 2022 at 9:59:31 am'! !Process methodsFor: 'signaling' stamp: 'jar 6/26/2022 20:35'! pvtSignal: anException "Private. This method is used to signal an exception from another process...the receiver must be the active process." "Since this method is not called in a normal way, we need to take care that it doesn't directly return to the caller (because I believe that could have the potential to push an unwanted object on the caller's stack)." | blocker | self isActiveProcess ifFalse: [^self]. anException signal. blocker := Semaphore new. [self suspend. suspendedContext := suspendedContext swapSender: nil. self resume] fork. blocker wait. ! ! !Process methodsFor: 'signaling' stamp: 'jar 6/26/2022 23:54'! signalException: anException "Signal an exception in the receiver process...if the receiver is currently suspended, the exception will get signaled when the receiver is resumed. If the receiver is blocked on a Semaphore, it will be immediately re-awakened and the exception will be signaled; if the exception is resumed, then the receiver will return to a blocked state unless the blocking Semaphore has excess signals" | oldList | "If we are the active process, go ahead and signal the exception" self isActiveProcess ifTrue: [^anException signal]. "Suspend myself first to ensure that I won't run away in the midst of the following modifications." (oldList := myList) ifNotNil: [self suspend]. suspendedContext ifNil: [self error: 'no suspended context!!!!']. "Add a new method context to the stack that will signal the exception" suspendedContext := Context sender: suspendedContext receiver: self method: (self class lookupSelector: #pvtSignal:) arguments: {anException}. "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]! !