inter-process signaling

Stephen Pair stephen at pairhome.net
Fri Sep 19 18:56:23 UTC 2003


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).

Of course, you could parallel all of the uses of inter-process signaling 
in Unix using this mechanism.

- Stephen



More information about the Squeak-dev mailing list