[Haskell-cafe] Detecting unused read handles? (was: File handles and pipes)

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Oct 19 11:07:10 EDT 2008

On 2008 Oct 19, at 2:39, Stephen Hicks wrote:
>> I've got one more question now.  Suppose I want to do the same thing
> on the other side, with two processes *receiving* the data.  Is there
> a way to tell whether the first process wants input, and if not, wait
> for the second process to do anything?

Not readily, because if the process ends up outputting more than a  
certain amount (_PIPE_BUF kernel parameter) of data your program will  
deadlock.  I think you need to forkIO and use MVars to synchronize.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list