Hi --<div><br></div><div>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.)</div><div><br>
</div><div>For example, using non-blocking IO and e.g. a synchronized condition variable; hWaitForInput might work in your case, or something like the following: <a href="http://hpaste.org/52742">http://hpaste.org/52742</a></div>
<div><br></div><div>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.</div>
<div><br></div><div>Hope that helps,</div><div> Alvaro</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><br><div class="gmail_quote">On Sat, Apr 28, 2012 at 2:23 PM, H. M. <span dir="ltr">&lt;<a href="mailto:h._h._h._@hotmail.com" target="_blank">h._h._h._@hotmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello,<br>
<br>
The simplified problem:<br>
<br>
There are two threads, one which is waits on input via<br>
hGetLine<br>
and another, which should terminate this thread or close this handle.<br>
<br>
hClose<br>
as well as<br>
killThread<br>
doesn&#39;t seem to work, caused by the fact, that the thread is blocked until input<br>
is availiable.<br>
<br>
Hopefully you have some solution how to kill the thread and/or close the handle<br>
and/or have some other idea to get the lined input in the other thread.<br>
<br>
--<br>
Thanks in advance<br>
H.<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>