This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix sem_post race (bug 14532)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Wed, 12 Sep 2012 15:19:34 +0000
- Subject: Re: Fix sem_post race (bug 14532)
- References: <Pine.LNX.4.64.1208302108250.15919@digraph.polyomino.org.uk><1347399660.3374.296.camel@triegel.csb>
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