[Haskell-cafe] Threads and hGetLine

Joey Adams joeyadams3.14159 at gmail.com
Sun Apr 29 07:51:35 CEST 2012

On Sat, Apr 28, 2012 at 2:23 PM, H. M. <h._h._h._ at hotmail.com> wrote:
> There are two threads, one which is waits on input via
> hGetLine
> and another, which should terminate this thread or close this handle.
> hClose
> as well as
> killThread
> doesn't seem to work, caused by the fact, that the thread is blocked until input
> is availiable.

What OS?  GHC currently doesn't have proper IO manager support for
Windows.  On Windows, IO is performed through FFI calls.  An FFI call
masks asynchronous exceptions (C code generally doesn't expect to be
interrupted at arbitrary points in time).  If another thread tries to
`killThread` the thread waiting for input, the exception will not be
received until the FFI call completes.  This means both threads will


More information about the Haskell-Cafe mailing list