Active process termination part of #terminate contains a line that's been a mystery to me:
| ctxt unwindBlock oldList outerMost | self isActiveProcess ifTrue: [ctxt := thisContext. [ctxt := ctxt findNextUnwindContextUpTo: nil. ctxt ~~ nil] whileTrue: [(ctxt tempAt: 2) ifNil: ---> ["N.B. Unlike Context>>unwindTo: we do not set complete (tempAt: 2) to true." unwindBlock := ctxt tempAt: 1. thisContext terminateTo: ctxt. unwindBlock value]]. thisContext terminateTo: nil.
It appears however that the absence of the assignment (ctxt tempAt: 2 put: true.) will cause the image crash e.g. in this scenario (probably irrecoverably; I had to kill it):
| p | p := [ [ Processor activeProcess terminate ] ensure: [ Processor activeProcess terminate ]. ] fork. Processor yield. Transcript show: p isTerminated printString
I already mentioned this anomaly in [1] where it was causing an inability to close a debugger.
The same algorithm is used in Context >> #resume:[through:] and #unwindTo:, but always with the assignment.
I was wondering whether the reason for the intentional omission of the assignment was just saving a line considered useless or whether there was a deeper idea... Anybody remembers?
Thanks for any advice.
[1] http://forum.world.st/Bug-in-Process-terminate-Returning-from-unwind-context...
----- ^[^ Jaromir -- Sent from: http://forum.world.st/Squeak-Dev-f45488.html
squeak-dev@lists.squeakfoundation.org