Error in Semaphore>>critical:ifError:

Daniel Vainsencher daniel.vainsencher at gmail.com
Wed Sep 14 22:26:58 UTC 2005


I've often found myself signaling a Semaphore manually because something 
stopped working after some debugging. For example the NetNameResolver. 
The test included shows whats wrong, and how the same thing works in 
critical:

I'm posting it here in case someone has history about this...

Daniel
-------------- next part --------------
'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 14 September 2005 at 3:22:30 pm'!
TestCase subclass: #SemaphoreTest
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Kernel-Processes-Tests'!

!SemaphoreTest methodsFor: 'as yet unclassified' stamp: 'dvf 9/14/2005 15:18'!
testCritical
	| lock |
	lock := Semaphore forMutualExclusion.
	[lock critical: [Processor activeProcess terminate]] forkAt: Processor userInterruptPriority.
	self assert: lock isSignaled! !

!SemaphoreTest methodsFor: 'as yet unclassified' stamp: 'dvf 9/14/2005 15:22'!
testCriticalIfError
	| lock |
	lock := Semaphore forMutualExclusion.
	[lock critical: [Processor activeProcess terminate] ifError:[]] forkAt: Processor userInterruptPriority.
	self assert: lock isSignaled! !


More information about the Squeak-dev mailing list