patch applied (packages/base): FIX: #724 (tee complains if used in a process started by ghc)

Simon Marlow simonmar at microsoft.com
Mon May 7 08:35:36 EDT 2007


Mon May  7 05:35:37 PDT 2007  Simon Marlow <simonmar at microsoft.com>
  * FIX: #724 (tee complains if used in a process started by ghc)
  
  Now, we only set O_NONBLOCK on file descriptors that we create
  ourselves.  File descriptors that we inherit (stdin, stdout, stderr)
  are kept in blocking mode.  The way we deal with this differs between
  the threaded and non-threaded runtimes:
  
   - with -threaded, we just make a safe foreign call to read(), which
     may block, but this is ok.
  
   - without -threaded, we test the descriptor with select() before
     attempting any I/O.  This isn't completely safe - someone else
     might read the data between the select() and the read() - but it's
     a reasonable compromise and doesn't seem to measurably affect
     performance.

    M ./GHC/Handle.hs -59 +140
    M ./GHC/IO.hs -3 +3
    M ./GHC/IOBase.lhs -1 +2
    M ./cbits/inputReady.c -4 +9


More information about the Cvs-libraries mailing list