|
Boost : |
Subject: [boost] bjam's use of O_NONBLOCK in execunix.c
From: Dan Gohman (gohman_at_[hidden])
Date: 2010-05-06 13:29:23
Hello,
Why does bjam on "unix" platforms set the O_NONBLOCK flag when creating
standard output and error pipes from the child process to the parent process?
https://svn.boost.org/trac/boost/browser/trunk/tools/jam/src/execunix.c#L189
This was introduced in change r38009:
https://svn.boost.org/trac/boost/changeset/38009
The parent process uses select(2) to block and wait for output from children,
so it doesn't appear to need non-blocking file descriptors.
Child processes are unrelated programs, and it seems mistaken to assume that
they will want their stdout and stderr to be non-blocking. A project that
I'm involved in recently had to add code to handle EAGAIN from a write(2) call
by spinning until it succeeds, and it seems to be fairly common practice.
It would seem to be better if the parent would just leave the file descriptors
in blocking mode.
Thanks,
Dan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk