[Pkg] The Trunk: Exceptions-mtf.28.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 3 13:42:53 UTC 2010


Matthew Fulmer uploaded a new version of Exceptions to project The Trunk:
http://source.squeak.org/trunk/Exceptions-mtf.28.mcz

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

Name: Exceptions-mtf.28
Author: mtf
Time: 3 June 2010, 9:46:39.119 am
UUID: e317b25a-109f-492d-95e1-90d163e9d7bf
Ancestors: Exceptions-nice.27

Added the option to make error handlers be re-entrant, and made a test case for it. Depends on Kernel-mtf.455. The default behavior is completely unchanged.

This is needed for preserving Tweak island semantics in the presence of syncSends and error resignalling. 

=============== Diff against Exceptions-nice.27 ===============

Item was added:
+ TestCase subclass: #ExceptionsTest
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'Exceptions-Extensions'!

Item was added:
+ ----- Method: ExceptionsTest>>testHandlerReentrancy (in category 'as yet unclassified') -----
+ testHandlerReentrancy
+ 
+ 	| callingOrder |
+ 	"Handlers are not re-entrant by default, so inner is not activated twice"
+ 	callingOrder := String streamContents: [:stream |
+ 		[[stream nextPut: $s. Notification signal]
+ 		
+ 			"Inner handler"
+ 			on: Notification do: [:ex |
+ 				stream nextPut: $i.
+ 				ex pass]]
+ 		
+ 			"outer handler"
+ 			on: Notification do: [:ex |
+ 				stream nextPut: $o.
+ 				Notification signal]].
+ 		
+ 	self assert: callingOrder = 'sio'.
+ 
+ 	"Now make inner re-entrant"
+ 	callingOrder := String streamContents: [:stream |
+ 		[[stream nextPut: $s. Notification signal]
+ 		
+ 			"Inner handler"
+ 			on: Notification do: [:ex |
+ 				stream nextPut: $i.
+ 				ex rearmHandlerDuring: [ex pass]]]
+ 		
+ 			"outer handler"
+ 			on: Notification do: [:ex |
+ 				stream nextPut: $o.
+ 				Notification signal]].
+ 		
+ 	self assert: callingOrder = 'sioi'.!

Item was added:
+ ----- Method: Exception>>rearmHandlerDuring: (in category 'handling') -----
+ rearmHandlerDuring: aBlock
+ "Make the current error handler re-entrant while it is running aBlock. Only works in a closure-enabled image"
+ 
+ 	^ handlerContext rearmHandlerDuring: aBlock!



More information about the Packages mailing list