[BUG] {almost-fix} Semaphore>>critical: is broken

Paul McDonough wnchips at yahoo.com
Thu Oct 12 02:04:57 UTC 2000


Craig Latta pointed out a much simpler way to do it:

!Semaphore methodsFor: 'mutual exclusion' stamp: 'pnm
10/11/2000 18:53'!
critical: mutuallyExcludedBlock 
	"Evaluate mutuallyExcludedBlock only if the receiver
is not currently in 
	the process of running the critical: message. If the
receiver is, evaluate 
	mutuallyExcludedBlock after the other critical:
message is finished."

	self wait.
	^mutuallyExcludedBlock
		ensure: [self signal]! !

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/





More information about the Squeak-dev mailing list