On Wed, 9 Sep 2009 01:20:06 +0200 Philippe Wang wrote: > > let x = Array.make 100 [] > > let update i n = x.(i) <- n :: x.(i) > > let read i = x.(i) > > I don't think you can obtain funny results when you don't put a mutex > on these two specific "update" and "read". > What is sure is that "update" function is not atomic because you have > a value allocation at the right of "<-" (with :: operator), and this > may trigger garbage collection and/or make the scheduler change the > running thread. Yes, that's not a problem. Thinking that over again it looks like the only issue remaining is the possibility that compiler can be too smart and cache/reorder memory operations, but ocamlopt is not of that kind, right? -- ygrek http://ygrek.org.ua