This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/3] Update to new generic semaphore algorithm.
- From: Torvald Riegel <triegel at redhat dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Tue, 08 May 2018 16:22:01 +0200
- Subject: Re: [PATCH 3/3] Update to new generic semaphore algorithm.
- References: <1417804668.22797.108.camel@triegel.csb> <1417807446.25868.24.camel@triegel.csb> <mvmr2mm6ydm.fsf@suse.de>
On Tue, 2018-05-08 at 16:00 +0200, Andreas Schwab wrote:
> On Dez 05 2014, Torvald Riegel <triegel@redhat.com> wrote:
>
> > diff --git a/nptl/sem_post.c b/nptl/sem_post.c
> > index 4906adf..0877774 100644
> > --- a/nptl/sem_post.c
> > +++ b/nptl/sem_post.c
>
> > +#else
> > + /* Add a token to the semaphore. Similar to 64b version. */
> > + unsigned int v = atomic_load_relaxed (&isem->value);
> > + do
> > {
> > - int err = lll_futex_wake (&isem->value, 1,
> > - isem->private ^ FUTEX_PRIVATE_FLAG);
> > - if (__builtin_expect (err, 0) < 0)
> > + if ((v << SEM_VALUE_SHIFT) == SEM_VALUE_MAX)
>
> This can never be true because SEM_VALUE_MAX is uneven. Did you mean
> (v >> SEM_VALUE_SHIFT)?
This has already been fixed in 88ed594f5d431d855256edbe7e886c8cf4b575dc.