#copyStack on Error
James Foster
Smalltalk at JGFoster.net
Tue Oct 30 16:29:27 UTC 2007
Rob Withers wrote:
> Let's say I have a process which is consuming events off of a queue.
> I don't want the process to ever terminate. If the handling of one of
> these events results in an Error, even a Halt, this process will be
> opened in the Debugger and the user could choose to abandon or
> terminate at will. Is it possible to copyStack the activeProcess and
> open that stack in the Debugger for the user. This way if the User
> terminates the process, it won't affect the main process.
>
> I wonder though, if the user resumes, will two proceses be consuming
> events from the queue? Perhaps I can copyStack using copyTo: a
> specific context that is above the point of consuming events, such
> that a resume will cause the copied stack to go away.
>
> Thanks for any assistance,
> Rob
One approach would be to have a "monitor" process that forks the "event
consumer" process. If the event consumer process terminates, the monitor
process would restart another one. The monitoring could be with a
semaphore that the event consumer signals in an unwind block. The
monitor process could also watch a flag to see if the event consumer
should be terminated or restarted.
James
More information about the Squeak-dev
mailing list
|