Simple question about Processes
Kevin Fisher
kgf at golden.net
Wed Nov 15 12:08:45 UTC 2000
> Kevin Fisher wrote:
> >
> > This is probably a silly question but... is there a proper way to make a
> > sub-process terminate itself correctly? For example, I've got a loop running
> > in a seperate process..how do I signal that this process is done from within
> > the process?
>
> Just fall off the end, break out of the loop, ... When the block that
> you forked ends, so does the process.
Ah, great...thanks for the pointer! I've spent too much time with UNIX
forks()...I keep looking for an exit(). :)
>
> > So far I've tried sending 'terminate' to the process object representing the
> > sub-process from -within- the sub-process, but this seems to leave behind an
> > UndefinedObject>>DoIt in the Process List browser. Am I missing something
> > obvious?
>
> Well, there's no reason to use terminate from within a process
> (and, in fact, it might not necessarily work well). Just fall off
> the end of the block, and make sure that there isn't another pointer
> to the process itself (so it'll get garbage collected).
>
> i.e.:
>
> [ 100 timesRepeat: [ 123 printString ] ] fork
>
> will not leave any trace behind after a garbage collect, as long
> as you don't keep any references to it.
>
I see. Yes, it does seem to do odd things if I try to terminate it from
within.
Does the presence of an UndefinedObject>>DoIt in the Process Browser mean
anything?
> --
> Ned Konz
> currently: Stanwood, WA
> email: ned at bike-nomad.com
> homepage: http://bike-nomad.com
More information about the Squeak-dev
mailing list
|