Problems interrupting IO with -threaded

Simon Marlow marlowsd at
Mon Jun 16 08:52:19 EDT 2008

Yitzchak Gale wrote:
> Judah Jacobson wrote:
>>> I'm writing a program that reads input from the user but should also
>>> handle a ctrl-c...
>>> It works fine compiled without -threaded, but with -threaded
>>> it blocks forever after a ctrl-c.
> Simon Marlow wrote:
>> Ah, this is a consequence of the change we made to stdin/stdout/stderr so
>> that they no longer use O_NONBLOCK, but with -threaded they use blocking
>> foreign calls instead...
>> I don't see a good workaround...
>> Unix semantics just isn't the right thing when it comes to non-blocking I/O.
>> If only there were non-blocking read()/write() system calls, we'd be fine.
> I believe you that the Unix semantics may not be very pretty. But all modern
> high-level programming languages have a getChar that can be
> interrupted by ^C. Can't we just do what they all do? This is basic,
> essential functionality that we use every day.
> In my opinion, Judah should file a bug, and it should be marked
> high priority.

You're right.  I've created a ticket:


More information about the Glasgow-haskell-users mailing list