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

Jaromir Matas m at jaromir.net
Sun Feb 28 19:08:37 UTC 2021


Hi, the following example shows a slight inconsistency in the process
terminantion logic:

   p := Process forContext: ([] asContextWithSender: thisContext) priority:
40

   p isTerminated   --> false

   p terminate 

   p isTerminated   --> false


I'm aware the example is nonsensical but I guess the terminate =>
isTerminated logic should be followed anyway.

I propose the following change in the #isTerminated condition. The idea is
if suspendedContext is the bottomContext and pc >= endPC then it should be
considered terminated regardless of whether there is or isn't a closure. The
rest of the condition remains intact. All tests green.

I also suggest a new wording of the comment (the bottomContext block doesn't
necessarily need to be the block in BlockClosure>>newProcess so I removed
the note).

The suggested version:

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."
		suspendedContext isBottomContext
		and: [suspendedContext pc >= suspendedContext endPC 
				or: [suspendedContext closure
						ifNil: [suspendedContext methodClass == Process
							and: [suspendedContext selector == #terminate]]
						ifNotNil: [false]]]]




-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list