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 in your case, or something like the
following: http://hpaste.org/52742

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,
 Alvaro










On Sat, Apr 28, 2012 at 2:23 PM, H. M. <[email protected]> wrote:

>
> 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.
>
> Hopefully you have some solution how to kill the thread and/or close the
> handle
> and/or have some other idea to get the lined input in the other thread.
>
> --
> Thanks in advance
> H.
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to