Login  Register

Re: Preventing process termination inside #ensure: block

Posted by Dmitry Zamotkin-5 on Apr 16, 2004; 1:27pm
URL: https://forum.world.st/Preventing-process-termination-inside-ensure-block-tp3370370p3370372.html

Hi David,

Here is a dirty solution:

p := [ [(Delay forSeconds: 1) wait] ensure: [
    ensureProcess := [
        Transcript nextPutAll: 'Inside ensure'; cr.
        (Delay forSeconds: 5) wait.
        Transcript nextPutAll: 'Done ensure'; cr] fork
    ]
] forkAt: Processor userBackgroundPriority.

(Delay forSeconds: 3) wait.
p terminate.

SessionManager inputState loopWhile: [ ensureProcess isDead not ].
Transcript nextPutAll: 'Ensure block is dead'; flush.

--
Dmitry Zamotkin