Subj : Re: Formal Mutex Semantics To : comp.programming.threads From : Maciej Sobczak Date : Tue Aug 16 2005 05:57 pm Joe Seigh wrote: > The mutex m1 has no effect since both threads aren't using it. Yes, that's the point. > Mutex > rule 2, since the 2nd thread sees a store by the 1st thread after its > lock action, the 2nd thread sees all stores by the 1st thread before its > unlock action. The store of a is before the unlock action by thread 1. That's fine - so you define it as "flush all, refresh all". Isn't it unnecessarily restrictive? I know that relaxing it would be confusing (for example, it would break the example from recent thread, "Memory visibility with Pthreads"), but it would still allow to write correct programs and in addition enable potential performance gains, since less stores would have required visibility. In that relaxed model, stores made outside any locks would have absolutely no guarantee with regard to their visibility in other threads. >> Related question: what does POSIX guarantee for this example? > > Posix though it best not to confuse you by trying to define anything. No jokes please. If I'm writing programs using pthreads then I should be able to reason about them, no? -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/ .