Fix #2363: getChar cannot be interrupted with -threaded
authorSimon Marlow <marlowsd@gmail.com>
Thu, 19 Jun 2008 14:19:11 +0000 (14:19 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 19 Jun 2008 14:19:11 +0000 (14:19 +0000)
commit636f9337e202be85065ec837d66d163b4b549205
tree8fa9eec9a77016dddcbbec7e71764eeacd000b93
parentec0f319384683be6603f5b2862e6621fe243dc65
Fix #2363: getChar cannot be interrupted with -threaded
Now in -threaded mode, instead of just making a blocking call to
read(), we call select() first to make sure the read() won't block,
and if it would block, then we use threadWaitRead.

The idea is that the current thread must be interruptible while it
blocks.  This is a little slower than before, but the overhead only
applies to blocking Handles (stdin/stdout/stderr, and those created by
System.Process).
GHC/Handle.hs