Fix sem_post race (bug 14532)

Joseph S. Myers joseph@codesourcery.com
Wed Sep 12 15:19:00 GMT 2012


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



More information about the Libc-alpha mailing list