[Haskell-cafe] writing to a fifo when the reader stops reading

Antoine Latter aslatter at gmail.com
Mon Mar 14 15:54:07 CET 2011


On Mon, Mar 14, 2011 at 9:44 AM,  <briand at aracnet.com> wrote:
> On Mon, 14 Mar 2011 02:33:13 -0400
> Brandon S Allbery KF8NH <allbery.b at gmail.com> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 3/13/11 03:16 , briand at aracnet.com wrote:
>> > ghc: fdWriteBuf: resource vanished (Broken pipe)
>> >
>> > which make sense, sort of.  I write a value, let's say 10, and the
>> > reader reads it.  It's the last value so it "closes" the fifo.
>> >
>> > Now there's nothing reading, so when I get to threadWaitWrite, I
>> > would expect the program to wait, just as it does when it starts up
>> > and there is no reader.
>>
>> FIFOs don't work that way; like a regular pipe, once all readers go
>> away it doesn't work any more.  You need to open it read-write
>> initially to keep a reader around.  Haskell has no control over
>> this:  it's how they're defined to work.
>
> ok,  I wanted to make sure that I wasn't missing something on the
> Haskell side.
>
>>
>> In general, trying to use a FIFO like an AF_UNIX socket is a mistake.
>>
>
>
> and using a socket doesn't really make sense because everything is
> running on the same host, always will be, and using sockets will
> unnecessarily complicate things.  although it's not that bad and works
> really well.
>

I think the prior emailer was recommending file sockets, not TCP
sockets: http://en.wikipedia.org/wiki/Unix_domain_socket

These only work on the same host.

> I'll go figure out a different strategy.
>
> Thank you,
>
> Brian
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list