[PATCH 3/3] Update to new generic semaphore algorithm.

Andreas Schwab schwab@suse.de
Tue May 8 14:00:00 GMT 2018


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)?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



More information about the Libc-alpha mailing list