[squeak-dev] The Inbox: Kernel-jar.1470.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 29 20:51:38 UTC 2022

A new version of Kernel was added to project The Inbox:

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

Name: Kernel-jar.1470
Author: jar
Time: 29 May 2022, 10:51:34.061501 pm
UUID: 18469d29-2a9e-074d-b7e3-12d8d981f4b5
Ancestors: Kernel-jar.1469

one more oops; check suspendedContext for nil

=============== Diff against Kernel-jar.1469 ===============

Item was changed:
  ----- Method: Process>>suspendAndReleaseCriticalSection (in category 'private') -----
  	"Figure out if we are terminating a process that is in the ensure: block of a critical section.
  	 If it hasn't made progress but is beyond the wait (which we can tell by the oldList being
  	 one of the runnable lists, i.e. a LinkedList, not a Semaphore or Mutex, et al), then the ensure:
  	 block needs to be run."
  	| oldList selectorJustSent |
  	"Suspend and unblock the receiver from a condition variable using suspend primitive #88.
  	 It answers the list the receiver was on before the suspension."
  	oldList := self suspendAndUnblock.
  	(oldList isNil or: [oldList class == LinkedList]) ifFalse: [^self].
+ 	((suspendedContext ifNil: [^self]) method pragmaAt: #criticalSection) ifNil: [^self].
- 	(suspendedContext method pragmaAt: #criticalSection) ifNil: [^self].
  	selectorJustSent := suspendedContext selectorJustSentOrSelf.
  	"If still at the wait the ensure: block has not been activated, so signal to restore."
  	selectorJustSent == #wait ifTrue:
  		[suspendedContext receiver signal].
  	"If still at the lock primitive and the lock primitive just acquired ownership (indicated by it answering false)
  	 then the ensure block has not been activated, so explicitly primitiveExitCriticalSection to unlock."
  	(selectorJustSent == #primitiveEnterCriticalSection
  	 or: [selectorJustSent == #primitiveTestAndSetOwnershipOfCriticalSection]) ifTrue:
  		[(suspendedContext stackPtr > 0
  		  and: [suspendedContext top == false]) ifTrue:
  			[suspendedContext receiver primitiveExitCriticalSection]]!

More information about the Squeak-dev mailing list