id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
2363,getChar cannot be interrupted with -threaded,simonmar,,"Now that `stdin`, `stdout` and `stderr` are left in blocking mode, when using the threaded RTS, I/O operations on these handles are no longer interruptible.  We ought to do something about this.

{{{
module Main where

import Control.Monad
import System.Posix.Signals
import Control.Concurrent
import Control.Concurrent.MVar

import System.IO

main = do
    hSetBuffering stdin NoBuffering
    hSetEcho stdin False
    mv <- newEmptyMVar
    let handler = putMVar mv Nothing
    installHandler sigINT (CatchOnce handler) Nothing
    tid <- forkIO (myGetChar mv)
    c <- takeMVar mv
    when (c==Nothing) $ do
        killThread tid
    putStrLn (""Result: "" ++ show c)

myGetChar mv = do
    c <- getChar
    putMVar mv (Just c)
}}}
",bug,closed,high,6.10 branch,libraries/base,6.8.2,fixed,,,Unknown/Multiple,Unknown/Multiple,,Unknown,,,,
