Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Peter Dimov Date : Wed May 25 2005 04:23 pm David Schwartz wrote: > "doug" wrote in message > news:ZyPje.1900$iq5.1180@fe1.news.blueyonder.co.uk... > >> I know where you're coming from - that's where I came from too. But >> some folk (Peter, Giancarlo) explained that *yes*, you might read >> the wrong value, but it doesn't matter. You're guaranteed to get >> the answer to the question "do I own this lock" correct. > > Guaranteed by what? > > Suppose you are thread "A1". The lock is held by "A2" and > transfers to "B1" while you are checking the owner field. What stops > you from seeing half of each and getting "A1", and thinking you own > the lock? We've been assuming atomic reads and writes, just no msync. .