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]

Re: Fix sem_post race (bug 14532)


On Tue, 11 Sep 2012, Torvald Riegel wrote:

> >    atomic_full_barrier ();
> 
> Why do we have the full barrier after the rel barrier?  Is it necessary?

I wouldn't say we have it after the rel barrier.  Apart from the rel 
barrier being a barrier before the compare-and-exchange operation, so the 
barriers are separated by that operation, the formatting of the code 
implies that the positioning of the barrier is logically "before the code 
to wake a waiter" rather than "after the code to update the semaphore 
value", and so the code to wake a waiter is where you should look for the 
reason for this barrier.

-- 
Joseph S. Myers
joseph@codesourcery.com


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