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

commits at source.squeak.org commits at source.squeak.org
Thu Mar 11 10:22:46 UTC 2021


A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-jar.1381.mcz

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

Name: Kernel-jar.1381
Author: jar
Time: 11 March 2021, 11:22:42.897307 am
UUID: 692824e3-388b-7a4c-98ca-03fcacdc8b37
Ancestors: Kernel-mt.1380

Fix a bug in Process #isTerminated and #isSuspended.

The issue has also shown recently on an issue http://forum.world.st/Bug-in-Process-gt-gt-terminate-Returning-from-unwind-contexts-td5127570.html where it was causing terminated processes remain in Process Browser (erroneously considering them not terminated).

The main threads discussing this are:

http://forum.world.st/The-Inbox-Kernel-jar-1376-mcz-td5127335.html#a5127336

http://forum.world.st/The-Inbox-Kernel-jar-1380-mcz-td5127524.html

=============== Diff against Kernel-mt.1380 ===============

Item was changed:
  ----- Method: Process>>isSuspended (in category 'testing') -----
  isSuspended
+ 	"A process is suspended if it has non-nil suspendedContext (e.g. new or 
+ 	previously suspended with the suspend primitive) and is not terminated or
+ 	waiting in a scheduler or a semaphore queue (i.e. is not runnable or blocked)."
+ 	
+ 	^myList isNil
+ 		and: [suspendedContext notNil]
+ 		and: [self isTerminated not]!
- 	"A process is suspended if it has been suspended with the suspend primitive.
- 	 It is distinguishable from the active process and a terminated process by
- 	 having a non-nil suspendedContext that is either not the bottom context
- 	 or has not reached its endPC."
- 	^nil == myList
- 	  and: [nil ~~ suspendedContext
- 	  and: [suspendedContext isBottomContext
- 			ifTrue: [suspendedContext closure
- 						ifNil: [suspendedContext methodClass ~~ Process
- 							or: [suspendedContext selector ~~ #terminate]]
- 						ifNotNil: [suspendedContext pc < suspendedContext closure endPC]]
- 			ifFalse: [true]]]!

Item was changed:
  ----- Method: Process>>isTerminated (in category 'testing') -----
  isTerminated
  	"Answer if the receiver is terminated, or at least terminating."
  	self isActiveProcess ifTrue: [^ false].
  	^suspendedContext isNil
+ 	  or: ["If the suspendedContext is the bottomContext and the pc is at the endPC, 
+ 		then there is nothing more to do."
- 	  or: ["If the suspendedContext is the bottomContext it is the block in Process>>newProcess.
- 		   If so, and the pc is at the endPC, the block has already sent and returned
- 		   from value and there is nothing more to do."
  		suspendedContext isBottomContext
+ 		and: [suspendedContext pc >= suspendedContext endPC 
+ 			or: [suspendedContext closure isNil
+ 				and: [suspendedContext methodClass == Process
+ 				and: [suspendedContext selector == #terminate]]]]]!
- 		and: [suspendedContext closure
- 						ifNil: [suspendedContext methodClass == Process
- 							and: [suspendedContext selector == #terminate]]
- 						ifNotNil: [suspendedContext pc >= suspendedContext closure endPC]]]!



More information about the Squeak-dev mailing list