[Haskell-cafe] Race conditions with threadWait(Read/Write) and closeFdWith

John Lato jwlato at gmail.com
Mon Sep 1 23:29:43 UTC 2014


On Tue, Sep 2, 2014 at 7:20 AM, Brandon Allbery <allbery.b at gmail.com> wrote:

> On Mon, Sep 1, 2014 at 7:13 PM, John Lato <jwlato at gmail.com> wrote:
>
>> I seem to recall that there are some other issues that arise if you
>> attempt to mix these low-level fd calls with higher-level fd operations,
>> but that was two IO managers ago so those concerns may be out of date.
>>
>>
> There are *always* issues with mixing low-level and high-level I/O,
> especially if the high-level I/O is buffered. It's best to not mix them.
> (Note that using handleToFd will safely give you something that you can do
> low level I/O with and will close the Handle; fdToHandle can't stop you
> from mixing them, though.)
>

Well, yes.  But fd operations are all pretty low-level relative to Handle
ops.  I specifically meant mixing functions in GHC.Conc.IO (threadWaitRead
etc) with functions from System.Posix.IO (e.g. fdReadBuf).  Which you'd
think should be relatively simple to have work together (and maybe it is,
provided you're familiar with fd's and non-blocking IO, etc).

If you want to use fdToHandle and call functions on both the fd and the
Handle, good luck with that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140902/8b7bd942/attachment.html>


More information about the Haskell-Cafe mailing list