Thread-backed handles: thread blocked indefinitely in an MVar
golubovsky at gmail.com
Sun Jun 20 22:51:57 EDT 2010
I am experimenting with the new feature in GHC such as custom Handles.
I use GHC 6.12.2, base 22.214.171.124
I have pasted the code in question as
I am trying to create a Handle using a thread as data producer. In my
example is is a union of directories, and the Handle contents is
newline-separated list of full paths of all files in the union. This
list is produced by a thread which reads contents of all directories
in the union, turns them into absolute filenames, and sends to the
channel. The method of BufferedIO responsible for filling in the
Handle's buffer reads data from the channel and places it in the
The problem is, after the contents of the Handle (via hGetContents)
has been consumed, the program crashes with the following message:
<program name>: thread blocked indefinitely in an MVar operation
that is, the BlockedIndefinitelyOnMVar exception has occurred.
What is done wrong in my code? The dirClose method seems to be called
(its output shows up), however with or without the call to killThread,
the exception occurs anyway.
Thanks for any ideas.
Anywhere on the Web
More information about the Glasgow-haskell-users