Re: A zvt fork question

> Hassan Aurag <> writes:
> > then I get two numbers, the exit number which is 0 for success and 
> > before it "usually" (sometimes after it" the pid number.
> > 
> Grab your favorite UNIX book and read about fork(). You have two
> processes after the fork; each does the "print pid".  The parent's pid
> variable is the child's pid, the child's pid variable is 0.

Yes that is exactlty right, the return value is identical to fork().

If the pid==0, you are in the child, otherwise you are in the parent.
Only if it is -1 was there an error (usually memory or process limits

You shouldn't need the pid for resource usage tracking anyway, you
can just attach data to the (or indexed by the) zvt widget, for example,
because it can only ever have one child.  And the zvt widget
tracks the 'child' resource as well.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]