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

Antoine Latter aslatter at gmail.com
Fri Dec 31 11:12:45 CET 2010


Have you tried it? Did you run in to any trouble?

Assuming you get locking correct there shouldn't be any trouble with this.

Take care,
Antoine

On Fri, Dec 31, 2010 at 4:19 AM, Eric Stansifer
<eric.stansifer+haskell at gmail.com> 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?
>
> (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
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list