From 9daba4f4b988977b01427a47908a0ca4ab717984 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 20 Mar 2003 10:28:06 +0000 Subject: [PATCH] Replace __lll_add calls with atomic_exchange_and_add calls respectively. --- nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c | 2 +- nptl/sysdeps/unix/sysv/linux/ia64/sem_post.c | 2 +- nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c | 2 +- nptl/sysdeps/unix/sysv/linux/sem_post.c | 2 +- nptl/sysdeps/unix/sysv/linux/sem_timedwait.c | 4 ++-- nptl/sysdeps/unix/sysv/linux/sem_trywait.c | 2 +- nptl/sysdeps/unix/sysv/linux/sem_wait.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c b/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c index 2f671fac41..c9e6be16b8 100644 --- a/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c +++ b/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c @@ -80,7 +80,7 @@ __pthread_once (once_control, init_routine) /* Add one to *once_control. */ - __lll_add (once_control, 1); + atomic_exchange_and_add (once_control, 1); /* Wake up all other threads. */ lll_futex_wake (once_control, INT_MAX); diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/sem_post.c b/nptl/sysdeps/unix/sysv/linux/ia64/sem_post.c index 9b5049e7ae..0527abeba6 100644 --- a/nptl/sysdeps/unix/sysv/linux/ia64/sem_post.c +++ b/nptl/sysdeps/unix/sysv/linux/ia64/sem_post.c @@ -32,7 +32,7 @@ __new_sem_post (sem_t *sem) int *futex = (int *) sem; int err, nr; - nr = __lll_add (futex, 1); + nr = atomic_exchange_and_add (futex, 1); err = lll_futex_wake (futex, nr + 1); if (__builtin_expect (err, 0) < 0) { diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c b/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c index 18029e979d..88acb26e03 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c @@ -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. */ - __lll_add (once_control, 1); + atomic_exchange_and_add (once_control, 1); /* Wake up all other threads. */ lll_futex_wake (once_control, INT_MAX); diff --git a/nptl/sysdeps/unix/sysv/linux/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sem_post.c index 77defc84f9..2da6ecd696 100644 --- a/nptl/sysdeps/unix/sysv/linux/sem_post.c +++ b/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -33,7 +33,7 @@ __new_sem_post (sem_t *sem) int err, nr; __asm __volatile (__lll_rel_instr ::: "memory"); - nr = __lll_add (futex, 1); + nr = atomic_exchange_and_add (futex, 1); err = lll_futex_wake (futex, nr); if (err == 0) return 0; diff --git a/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c b/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c index e1b32f4e78..632cce4391 100644 --- a/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c +++ b/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c @@ -36,7 +36,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime) if (*futex > 0) { - val = __lll_dec_if_positive (futex); + val = atomic_decrement_if_positive (futex); if (val > 0) return 0; } @@ -75,7 +75,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime) if (err != 0 && err != -EWOULDBLOCK) goto error_return; - val = __lll_dec_if_positive (futex); + val = atomic_decrement_if_positive (futex); } while (val <= 0); diff --git a/nptl/sysdeps/unix/sysv/linux/sem_trywait.c b/nptl/sysdeps/unix/sysv/linux/sem_trywait.c index a7b60a1023..f500361143 100644 --- a/nptl/sysdeps/unix/sysv/linux/sem_trywait.c +++ b/nptl/sysdeps/unix/sysv/linux/sem_trywait.c @@ -35,7 +35,7 @@ __new_sem_trywait (sem_t *sem) if (*futex > 0) { - val = __lll_dec_if_positive (futex); + val = atomic_decrement_if_positive (futex); if (val > 0) return 0; } diff --git a/nptl/sysdeps/unix/sysv/linux/sem_wait.c b/nptl/sysdeps/unix/sysv/linux/sem_wait.c index 0e50067cf6..1d39b7c408 100644 --- a/nptl/sysdeps/unix/sysv/linux/sem_wait.c +++ b/nptl/sysdeps/unix/sysv/linux/sem_wait.c @@ -38,7 +38,7 @@ __new_sem_wait (sem_t *sem) { if (*futex > 0) { - val = __lll_dec_if_positive (futex); + val = atomic_decrement_if_positive (futex); if (val > 0) return 0; }