This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

why using acquire semantics in the atomic operations in pthread_mutex_unlock?


I'm trying to wrap my head around the memory barrier semantics in
pthread mutex operations.

I was under the impression that an unlock implies a write barrier, or
release semantics.  This is borne out by the fact that for a regular
mutex we call lll_unlock() which for powerpc calls atomic_exchange_rel().

However, for priority inheritance or priority protection mutexes, the
unlock code path for the uncontended case ends up calling
atomic_compare_and_exchange_bool_acq(), which has acquire rather than
release semantics.

I assume I'm missing something--where is the write barrier for these cases?

Thanks,

Chris


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