[squeak-dev] Re: Improving a Process termination procedure

Julian Fitzell jfitzell at gmail.com
Fri May 1 16:28:25 UTC 2009


On Fri, May 1, 2009 at 3:11 AM, Igor Stasenko <siguctua at gmail.com> wrote:
> Another improvement would be to marry the process termination with
> exception handling,
> and nicely signal ProcessTerminatedException.

Which is pretty much what VW does, I think.

> This offers many practical benefits, since then we could write:
>
> [ ... ] on: ProcessTerminatedException do: [:ex |
>   "oh man we're been terminated"
> ].
>
> But i'm not expert in exception handling.
> Can someone give me a sample, how to signal such exception in potential
> #terminateFromContext: method?

Seems like you would just do "ProcessTerminatedException signal" as
long as the receiver was the active process. If not the active
process, you would have to replace the suspended context with a new
context that will signal the exception as soon as the process is next
run.

The strange thing about this implementation is that you can write code
that actually prevents your process from being terminated. I'm not
saying that's a bad thing (maybe it's even a good thing for certain
pieces of code) but it certainly changes the semantics of #terminate a
little. :) And that being the case, the name
ProcessTerminatedException is a bit misleading because it implies that
the process already *has* been terminated. TerminateProcessException,
TerminateProcessRequest, or just TerminateProcess would be more
accurate.

Julian



More information about the Squeak-dev mailing list