[Haskell-cafe] thread safety, IO arrays, and IO refs

Eric Stansifer eric.stansifer+haskell at gmail.com
Fri Dec 31 10:19:13 CET 2010


Hello,

I wish to use a mutable array in multiple threads.  Can IO arrays be
used in any thread, or only the thread they are created in?  (So if I
create an IO array in one thread, pass it to another via an MVar, can
I read / edit it in that other thread?)  Similarly about IORefs... can
they be used across threads?

(Obviously I will need to manage locking myself if I use an IO ref or array.)

Are there any good resources on concurrency in Haskell that would
answer questions similar to these?  I've been learning by reading the
ghc library documentation, but of course it's not comprehensive.  The
online tutorials I've seen aren't so in-depth, either.

Thanks,
Eric



More information about the Haskell-Cafe mailing list