concurrency (was Re: important news: refocusing discussion)

isaac jones ijones at galois.com
Tue Mar 28 13:02:47 EST 2006


On Tue, 2006-03-28 at 11:05 +0100, Malcolm Wallace wrote:
(snip)
>   * IORef is inherently thread-unsafe, and so we should eliminate IORefs
>     from the language.

That's not quite true, as you can have an IORef guarded by an MVar.  Why
would you want such a thing?  For instance, you might write a library
with two IORefs and one MVar instead of two MVars in order to reduce the
possibility of deadlock.

Is it the case that a library is thread-safe as long as it doesn't use
IORefs, though?  I trolled around base looking for libraries that might
not be thread-safe and found only that HashTable uses an IORef, and
indeed there's a FIXME that says it should use an MVar.  I didn't look
very hard, though.

peace,

  isaac



More information about the Haskell-prime mailing list