Ian Lance Taylor writes: > Andrew Haley <[EMAIL PROTECTED]> writes: > > > The problem is code like this: > > > > int counter; > > > > ... > > > > if (we_hold_counters_mutex) > > counter++; > > > > This is legal POSIX threads code: counter is not accessed when we do > > not hold the mutex. According to POSIX we do not have to declare > > volatile memory that we only access when we hold a mutex. > > Where does POSIX say that?
I think that's just the point: POSIX doesn't directly state it, but it implies it. The exact language used by POSIX is rather vague, and is discussed at length in H. Boehm, ``Threads Cannot Be Implemented As a Library'', http://www.hpl.hp.com/techreports/2004/HPL-2004-209.html. This paper was quite enough to convince me. Andrew.