Re: [Haskell-cafe] Threads and hGetLine

2012-05-02 Thread Johannes Waldmann
There are two threads, one which is waits on input via hGetLine and another, which should terminate this thread or close this handle. like this? The trick is to fork the blocking call (hGetLine) and wait on an MVar. That way, the kill signal can be handled: {-# language PatternSignatures

[Haskell-cafe] Threads and hGetLine

2012-04-28 Thread H. M.
Hello, The simplified problem: 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.

Re: [Haskell-cafe] Threads and hGetLine

2012-04-28 Thread Alvaro Gutierrez
Hi -- I am not well-versed in Haskell-specific multi-threading, but usually there is a better way to do what you want that does not involve killing threads (which in most cases is bad idea.) For example, using non-blocking IO and e.g. a synchronized condition variable; hWaitForInput might work

Re: [Haskell-cafe] Threads and hGetLine

2012-04-28 Thread Joey Adams
On Sat, Apr 28, 2012 at 2:23 PM, H. M. h._h._...@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