[squeak-dev] Bug in Process>>#terminate | Returning from unwind contexts

Jaromir Matas m at jaromir.net
Wed Mar 10 10:30:11 UTC 2021


Hi Christoph,

I'd like to recommend to use the fixed #isTerminated: (it's not in the Trunk
yet because it can be done nicer but this one is at least working ok). 

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 isNil
				and: [suspendedContext methodClass == Process
				and: [suspendedContext selector == #terminate]]]]]

Originally I noticed the bug on a nonsensical example but in your scenario
it also plays a role! Some processes will be rightly considered terminated
and disappear from Process Browser (#runUntilErrorOrReturnFrom among others,
in my scenarios).

It seems to me after `ctxt restart` the thread never returns back so the
assignment is moot?

At any rate it seems to me the problem is not related to non-local returns
exclusively. Other scenario I have now:
x:=nil. [self error: 'x1'] ensure: [[self error: 'x2'] ensure: [[self error:
'x3'] ensure: [x:=3]. x:=2]. x:=1].
x

Unfortunately I've got to run now but I'll continue investigating tomorrow.
Very interesting! :)
Thanks,



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


More information about the Squeak-dev mailing list