[squeak-dev] The Trunk: Kernel-eem.1485.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jun 27 18:11:02 UTC 2022


Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1485.mcz

==================== Summary ====================

Name: Kernel-eem.1485
Author: eem
Time: 27 June 2022, 11:10:59.266876 am
UUID: aceefea5-ba4c-4a8a-8d7d-a2872626fb57
Ancestors: Kernel-eem.1484

Commit essentially Jaromir's version of Process>>signalException:.  There's a small variation here; a signal to a terminated process is merely discarded, rather than an error raised.

=============== Diff against Kernel-eem.1484 ===============

Item was changed:
  ----- Method: Process>>signalException: (in category 'signaling') -----
  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"
  
  	"If we are the active process, go ahead and signal the exception"
  	 self isActiveProcess ifTrue: [^anException signal].
  
+ 	"One could raise an error here but that would force clients to employ a guard.
+ 	 Since a terminated process can have no response to a signal (there is no
+ 	 where for a handler to exist) it is legitimate to simply discard the signal."
+ 	suspendedContext ifNil: [^self].
+ 
  	"Suspend myself first to ensure that I won't run away
  	 in the midst of the following modifications."
  	self isSuspended ifFalse:
  		[self suspend].
+ 
+ 	"Add a new block context to the stack that will signal the exception (jar 6/27/2022)"
+ 	suspendedContext := 
+ 		[anException signal. thisContext sender jump] asContextWithSender: suspendedContext.
+ 	"Since this block is not called in a normal way, we need to take care
+ 	that it doesn't directly return to the caller (because that could have 
+ 	the potential to push an unwanted object on the caller's stack).
+ 	Workspace example:
+ 		p := [Semaphore new wait] fork.
+ 		Processor yield.
+ 		p signalException: Notification
+ 	"
- 	suspendedContext ifNil: [self error: 'no suspended context!!!!'].
- 	suspendedContext := Context
- 								sender: suspendedContext
- 								receiver: anException
- 								method: (anException class lookupSelector: #signal)
- 								arguments: #().
  	^self resume!



More information about the Squeak-dev mailing list