Brad Clow wrote:
On Nov 28, 2007 11:30 AM, Matthew Brecknell <[EMAIL PROTECTED]> wrote:
Even with threads, results are evaluated only when they are needed (or
when forced by a strictness annotation). So the thread that needs a
result (or forces it) first will be the one to evaluate it.

So does GHC implement some sychronisation given that a mutation is
occuring under the covers, ie. the thunk is being replaced by the
result?

Yes, see

http://haskell.org/~simonmar/bib/multiproc05_abstract.html

we use lock-free synchronisation, with a slight possibility that two threads might evaluate the same thunk. But since they'll produce the same result, nothing goes wrong.

Cheers,
        Simon
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to