���'From Squeak6.1alpha of 27 January 2023 [latest update: #22417] on 3 February 2023 at 8:26:43 pm'! !LinkedList methodsFor: 'private' stamp: 'jar 2/3/2023 19:56'! releaseCriticalSection: aContext ^aContext receiver stepIntoCriticalSection: aContext! ! !Mutex methodsFor: 'private' stamp: 'jar 2/3/2023 19:57'! releaseCriticalSection: aContext ^aContext pc: aContext endPC! ! !Mutex methodsFor: 'private' stamp: 'jar 2/3/2023 19:57'! stepIntoCriticalSection: aContext ^(aContext stackPtr > 0 and: [aContext top == false]) ifTrue: [aContext stepToCallee] ifFalse: [aContext]! ! !Process methodsFor: 'private' stamp: 'jar 2/3/2023 19:58'! suspendAndReleaseCriticalSection "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), then the ensure: block needs to be run." "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 | oldList := self suspendAndUnblock ifNil: [LinkedList new]. ((suspendedContext ifNil: [^self]) method pragmaAt: #criticalSection) ifNil: [^self]. suspendedContext := oldList releaseCriticalSection: suspendedContext! ! !Semaphore methodsFor: 'private' stamp: 'jar 2/3/2023 19:58'! releaseCriticalSection: aContext ^aContext pc: aContext endPC! ! !Semaphore methodsFor: 'private' stamp: 'jar 2/3/2023 19:58'! stepIntoCriticalSection: aContext ^aContext stepToCallee! ! !Semaphore reorganize! ('initialize-release' initSignals resumeProcess: terminateProcess) ('communication' signal wait waitIfLocked: waitTimeoutMSecs: waitTimeoutSeconds:) ('mutual exclusion' critical: critical:ifCurtailed: critical:ifError: critical:ifLocked:) ('comparing' = hash) ('testing' isSignaled) ('accessing' excessSignals) ('private' releaseCriticalSection: stepIntoCriticalSection:) ! !Mutex reorganize! ('mutual exclusion' critical: critical:ifLocked:) ('private-primitives' primitiveEnterCriticalSection primitiveExitCriticalSection primitiveTestAndSetOwnershipOfCriticalSection) ('system simulation' primitiveEnterCriticalSectionOnBehalfOf: primitiveTestAndSetOwnershipOfCriticalSectionOnBehalfOf:) ('testing' isOwned) ('private' releaseCriticalSection: stepIntoCriticalSection:) !