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

Simon Marlow marlowsd at gmail.com
Wed Jan 5 16:23:51 CET 2011


On 31/12/2010 09:19, Eric Stansifer wrote:
> 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?

There are no restrictions, you can use an IOArray or IORef in any thread.

Cheers,
	Simon



More information about the Haskell-Cafe mailing list