inter-process signaling

Ned Konz ned at bike-nomad.com
Fri Sep 19 20:35:47 UTC 2003


On Friday 19 September 2003 11:56 am, Stephen Pair wrote:
> One of the things that crossed my mind not too long ago is that it
> would be nice if we could signal exceptions in another process. 
> For example:
>
>   Error new messageText: 'some error message'; signalProcess:
> someProcess
>
> Or,
>
>   someProcess signal: (Error new messageText: 'some error message';
> yourself)
>
> This could be useful for graceful termination of processes (among
> many other things)...unwind actions could always happen in the
> process where they were defined.  The default action of a Terminate
> exception would be to terminate the active process.  Here's the
> method that seems to do the trick:
>
> Process>>signal: anException
>
>     Processor activeProcess == self ifTrue: [^anException signal].
>     suspendedContext := MethodContext
>         sender: suspendedContext
>         receiver: self
>         method: thisContext method
>         arguments: (Array with: anException).
>

Thanks!

I've asked for this several times and no one has come up with it yet.

One obvious use of this is to provide Semaphore>>wait methods that 
raise an exception on a timeout.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list