Environment variable does not work (especially DARCS_EDITOR)

Simon Marlow simonmar at microsoft.com
Fri Apr 22 03:55:03 EDT 2005

On 21 April 2005 17:57, Glynn Clements wrote:

> Simon Marlow wrote:
>>> The test program works after applying the following patch to GHC
>>> that disables nonblocking mode after the fork and before the exec.
>> If we did this, we would also need to re-enable non-blocking mode
>> after the rawSystem completes.  Also, this doesn't work well if
>> runProcess is used and the Haskell program continues to run while
>> the subprocess is executing, because the O_NONBLOCK flag is shared
>> between parent and child.
> Presumably the Haskell program won't like it very much if the spawned
> program disables O_NONBLOCK itself?
> Is there a reason (other than performance) why the use of O_NONBLOCK
> can't be replaced with calling select/poll before accessing the
> descriptor?

That would work, as long as the current process is the only user of that
file descriptor: otherwise there's a race condition between the select()
and the read().

This is really a Unix design blunder, there ought to be a non-blocking
version of read().

> Is non-blocking I/O only necessary if you need explicit concurrency?
> Or do the runtime or critical libraries require it?

Right, it's only important if you need concurrency.


More information about the Libraries mailing list