[Haskell-cafe] Threads and hGetLine
radical at google.com
Sun Apr 29 00:58:50 CEST 2012
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 in your case, or something like the
Nevertheless, as a guess, I think you may want to try using closeFdWith,
perhaps combined with a call to threadWaitRead before actually calling
hGetLine. The wrinkle is that those operate on file descriptors instead of
handles, but there are fdToHandle/mkHandleFromFD to bridge the gap.
Hope that helps,
On Sat, Apr 28, 2012 at 2:23 PM, H. M. <h._h._h._ at hotmail.com> wrote:
> The simplified problem:
> There are two threads, one which is waits on input via
> and another, which should terminate this thread or close this handle.
> as well as
> doesn't seem to work, caused by the fact, that the thread is blocked until
> is availiable.
> Hopefully you have some solution how to kill the thread and/or close the
> and/or have some other idea to get the lined input in the other thread.
> Thanks in advance
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe