This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimization of conditional access to globals: thread-unsafe?


On Mon, Oct 29, 2007 at 12:04:14 +0300, Tomash Brechko wrote:
> Rather, "...before it released the mutex, and we acuired the same
> mutex".  But it may be the same thread actually, so "final value" is
> the value that is seen by the thread at the beginning of excusive
> access to the object.  It is "final" wrt previous exclusive access to
> this object.

Note that this doesn't require the value to actually _be_ in the
memory, only to be observed as if it is there.  That's the power of
POSIX Threads, and that's why memory barriers, not cache flushes, are
behind pthread_mutex_lock() and friends.


-- 
   Tomash Brechko


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]