Replace __lll_add calls with atomic_exchange_and_add calls respectively.

This commit is contained in:
Ulrich Drepper 2003-03-20 10:28:06 +00:00
parent 53fcb88501
commit 9daba4f4b9
7 changed files with 8 additions and 8 deletions

View File

@ -80,7 +80,7 @@ __pthread_once (once_control, init_routine)
/* Add one to *once_control. */ /* Add one to *once_control. */
__lll_add (once_control, 1); atomic_exchange_and_add (once_control, 1);
/* Wake up all other threads. */ /* Wake up all other threads. */
lll_futex_wake (once_control, INT_MAX); lll_futex_wake (once_control, INT_MAX);

View File

@ -32,7 +32,7 @@ __new_sem_post (sem_t *sem)
int *futex = (int *) sem; int *futex = (int *) sem;
int err, nr; int err, nr;
nr = __lll_add (futex, 1); nr = atomic_exchange_and_add (futex, 1);
err = lll_futex_wake (futex, nr + 1); err = lll_futex_wake (futex, nr + 1);
if (__builtin_expect (err, 0) < 0) if (__builtin_expect (err, 0) < 0)
{ {

View File

@ -88,7 +88,7 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
/* Add one to *once_control to take the bottom 2 bits from 01 to 10. */ /* Add one to *once_control to take the bottom 2 bits from 01 to 10. */
__lll_add (once_control, 1); atomic_exchange_and_add (once_control, 1);
/* Wake up all other threads. */ /* Wake up all other threads. */
lll_futex_wake (once_control, INT_MAX); lll_futex_wake (once_control, INT_MAX);

View File

@ -33,7 +33,7 @@ __new_sem_post (sem_t *sem)
int err, nr; int err, nr;
__asm __volatile (__lll_rel_instr ::: "memory"); __asm __volatile (__lll_rel_instr ::: "memory");
nr = __lll_add (futex, 1); nr = atomic_exchange_and_add (futex, 1);
err = lll_futex_wake (futex, nr); err = lll_futex_wake (futex, nr);
if (err == 0) if (err == 0)
return 0; return 0;

View File

@ -36,7 +36,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
if (*futex > 0) if (*futex > 0)
{ {
val = __lll_dec_if_positive (futex); val = atomic_decrement_if_positive (futex);
if (val > 0) if (val > 0)
return 0; return 0;
} }
@ -75,7 +75,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
if (err != 0 && err != -EWOULDBLOCK) if (err != 0 && err != -EWOULDBLOCK)
goto error_return; goto error_return;
val = __lll_dec_if_positive (futex); val = atomic_decrement_if_positive (futex);
} }
while (val <= 0); while (val <= 0);

View File

@ -35,7 +35,7 @@ __new_sem_trywait (sem_t *sem)
if (*futex > 0) if (*futex > 0)
{ {
val = __lll_dec_if_positive (futex); val = atomic_decrement_if_positive (futex);
if (val > 0) if (val > 0)
return 0; return 0;
} }

View File

@ -38,7 +38,7 @@ __new_sem_wait (sem_t *sem)
{ {
if (*futex > 0) if (*futex > 0)
{ {
val = __lll_dec_if_positive (futex); val = atomic_decrement_if_positive (futex);
if (val > 0) if (val > 0)
return 0; return 0;
} }