Fwd: Improving a Process termination procedure

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Improving a Process termination procedure

Igor Stasenko
FYI


---------- Forwarded message ----------
From: Igor Stasenko <[hidden email]>
Date: 2009/5/1
Subject: Re: Improving a Process termination procedure
To: The general-purpose Squeak developers list
<[hidden email]>


Another improvement would be to marry the process termination with
exception handling,
and nicely signal ProcessTerminatedException.
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?

2009/5/1 Igor Stasenko <[hidden email]>:

> There are a potential of having incorrect behavior , when terminating
> a preempted or waiting process:
>
> with introduction of ProcessLocalVariable, it is essential that
> context unwinding procedure should be performed only
> for currently active process.
>
> Here the proposal how to ensure this:
>
> if terminating process is not active process we should do the following:
>
> suspendedContext := proc suspendedContext.
> currentProces := Processor activeProcess.
> proc suspendedContext:  [  Processor activeProcess
> terminateFromContext: suspendedContext. Processor switchToProcess:
> currentProcess ] asContext.
> Processor switchToProcess: proc.
>
> here #switchToProcess: is explicit switch (bypassing scheduling logic).
>
> If we don't care about immediate termination of process and getting
> back to process who initiated termination as soon as possible, then
> simply do:
> process terminateSoon.
>
> which can be implemented as:
>
> Process>>terminateSoon
> | termContext |
> termContext := suspendedContext.
> suspendedContext := [  self terminateFromContext: termContext. self
> suspend ] asContext.
> Processor yield.
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project