help-octave
[Top][All Lists]
Advanced

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

Re: Print plot error


From: Rob Mahurin
Subject: Re: Print plot error
Date: Mon, 24 Aug 2009 20:10:17 -0400

On Aug 24, 2009, at 6:19 PM, Dmitri A. Sergatskov wrote:
On Mon, Aug 24, 2009 at 4:39 PM, Rob Mahurin<address@hidden> wrote:
You probably want waitpid(-1,WNOHANG) so that print won't freeze if there is actually no child.

Attached as a patch (which is not a changeset, sorry). This would be good for 3.2.3.

With WNOHANG I see few (one or two) defunct processes remains after
loop of ~100 prints.

Sorry, I wasn't clear: it's safe to do
        while (0 < waitpid (-1, WNOHANG) ); endwhile

which cleans up any & all errant children, doing nothing if there are none.

That's not quite what I did in the patch, since I misunderstood waitpid's return values.

Ben Abbott asks:
Also what about children that are not zombies? Will such produce an infinite loop?

Not as written here (this one is tested).

Regarding the "zombies" does waitpid() kill them or just wait until the die?

No. A "zombie" is a process that has already called exit() but is being kept in memory so that its parent can check its exit status. There's a little information in the man page for ps, and wikipedia has a "zombie process" entry.

Rob

--
Rob Mahurin
University of Manitoba, Dept. of Physics & Astronomy
at:     Oak Ridge National Laboratory   865 207 2594
        Oak Ridge, Tennessee            address@hidden

Attachment: print.patch
Description: Binary data




reply via email to

[Prev in Thread] Current Thread [Next in Thread]