@@ -116,7 +116,7 @@ __futex_abstimed_wait_common (unsigned int* futex_word,
case -ENOSYS: /* Must have been caused by a glibc bug. */
/* No other errors are documented at this time. */
default:
- futex_fatal_error ();
+ __futex_fatal_error ();
}
}
@@ -200,6 +200,6 @@ __futex_lock_pi64 (int *futex_word, clockid_t clockid,
case -ENOSYS: /* Must have been caused by a glibc bug. */
/* No other errors are documented at this time. */
default:
- futex_fatal_error ();
+ __futex_fatal_error ();
}
}
@@ -31,7 +31,7 @@ __lll_lock_wait_private (int *futex)
{
futex:
LIBC_PROBE (lll_lock_wait_private, 1, futex);
- futex_wait ((unsigned int *) futex, 2, LLL_PRIVATE); /* Wait if *futex == 2. */
+ __futex_wait_internal ((unsigned int *) futex, 2, LLL_PRIVATE); /* Wait if *futex == 2. */
}
}
libc_hidden_def (__lll_lock_wait_private)
@@ -46,7 +46,7 @@ __lll_lock_wait (int *futex, int private)
{
futex:
LIBC_PROBE (lll_lock_wait, 1, futex);
- futex_wait ((unsigned int *) futex, 2, private); /* Wait if *futex == 2. */
+ __futex_wait_internal ((unsigned int *) futex, 2, private); /* Wait if *futex == 2. */
}
}
libc_hidden_def (__lll_lock_wait)
@@ -86,10 +86,10 @@ __nptl_setxid_sighandler (int sig, siginfo_t *si, void *ctx)
/* And release the futex. */
self->setxid_futex = 1;
- futex_wake (&self->setxid_futex, 1, FUTEX_PRIVATE);
+ __futex_wake_internal (&self->setxid_futex, 1, FUTEX_PRIVATE);
if (atomic_fetch_add_relaxed (&xidcmd->cntr, -1) == 1)
- futex_wake ((unsigned int *) &xidcmd->cntr, 1, FUTEX_PRIVATE);
+ __futex_wake_internal ((unsigned int *) &xidcmd->cntr, 1, FUTEX_PRIVATE);
}
libc_hidden_def (__nptl_setxid_sighandler)
@@ -102,7 +102,7 @@ setxid_mark_thread (struct xid_command *cmdp, struct pthread *t)
if (t->setxid_futex == -1
&& ! atomic_compare_and_exchange_bool_acq (&t->setxid_futex, -2, -1))
do
- futex_wait_simple (&t->setxid_futex, -2, FUTEX_PRIVATE);
+ __futex_wait_simple (&t->setxid_futex, -2, FUTEX_PRIVATE);
while (t->setxid_futex == -2);
/* Don't let the thread exit before the setxid handler runs. */
@@ -120,7 +120,7 @@ setxid_mark_thread (struct xid_command *cmdp, struct pthread *t)
if ((ch & SETXID_BITMASK) == 0)
{
t->setxid_futex = 1;
- futex_wake (&t->setxid_futex, 1, FUTEX_PRIVATE);
+ __futex_wake_internal (&t->setxid_futex, 1, FUTEX_PRIVATE);
}
return;
}
@@ -146,7 +146,7 @@ setxid_unmark_thread (struct xid_command *cmdp, struct pthread *t)
/* Release the futex just in case. */
t->setxid_futex = 1;
- futex_wake (&t->setxid_futex, 1, FUTEX_PRIVATE);
+ __futex_wake_internal (&t->setxid_futex, 1, FUTEX_PRIVATE);
}
@@ -233,7 +233,7 @@ __nptl_setxid (struct xid_command *cmdp)
int cur = cmdp->cntr;
while (cur != 0)
{
- futex_wait_simple ((unsigned int *) &cmdp->cntr, cur,
+ __futex_wait_simple ((unsigned int *) &cmdp->cntr, cur,
FUTEX_PRIVATE);
cur = cmdp->cntr;
}
@@ -47,7 +47,7 @@ __pthread_barrier_destroy (pthread_barrier_t *barrier)
thread will perform a reset. Wait until that has happened. */
while (in != 0)
{
- futex_wait_simple (&bar->in, in, bar->shared);
+ __futex_wait_simple (&bar->in, in, bar->shared);
in = atomic_load_relaxed (&bar->in);
}
}
@@ -123,7 +123,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
concurrently with a reset. */
while (i > max_in_before_reset)
{
- futex_wait_simple (&bar->in, i, bar->shared);
+ __futex_wait_simple (&bar->in, i, bar->shared);
/* Relaxed MO is fine here because we just need an indication for
when we should retry to enter (which will use acquire MO, see
above). */
@@ -164,7 +164,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
use of barriers.
Note that we can still access SHARED because we haven't yet
confirmed to have left the barrier. */
- futex_wake (&bar->current_round, INT_MAX, bar->shared);
+ __futex_wake_internal (&bar->current_round, INT_MAX, bar->shared);
/* We did as much as we could based on our position. If we advanced
the current round to a round sufficient for us, do not wait for
that to happen and skip the acquire fence (we already
@@ -181,7 +181,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
while (i > cr)
{
/* Wait for the current round to finish. */
- futex_wait_simple (&bar->current_round, cr, bar->shared);
+ __futex_wait_simple (&bar->current_round, cr, bar->shared);
/* See the fence below. */
cr = atomic_load_relaxed (&bar->current_round);
}
@@ -213,7 +213,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
destroyed. */
int shared = bar->shared;
atomic_store_release (&bar->in, 0);
- futex_wake (&bar->in, INT_MAX, shared);
+ __futex_wake_internal (&bar->in, INT_MAX, shared);
}
@@ -26,7 +26,7 @@ ___pthread_clockjoin_np64 (pthread_t threadid, void **thread_return,
clockid_t clockid,
const struct __timespec64 *abstime)
{
- if (!futex_abstimed_supported_clockid (clockid))
+ if (!__futex_abstimed_supported_clockid (clockid))
return EINVAL;
return __pthread_clockjoin_ex (threadid, thread_return,
@@ -64,7 +64,7 @@ ___pthread_cond_broadcast (pthread_cond_t *cond)
/* TODO Only set it if there are indeed futex waiters. We could
also try to move this out of the critical section in cases when
G2 is empty (and we don't need to quiesce). */
- futex_wake (cond->__data.__g_signals + g1, INT_MAX, private);
+ __futex_wake_internal (cond->__data.__g_signals + g1, INT_MAX, private);
}
/* G1 is complete. Step (2) is next unless there are no waiters in G2, in
@@ -82,7 +82,7 @@ ___pthread_cond_broadcast (pthread_cond_t *cond)
__condvar_release_lock (cond, private);
if (do_futex_wake)
- futex_wake (cond->__data.__g_signals + g1, INT_MAX, private);
+ __futex_wake_internal (cond->__data.__g_signals + g1, INT_MAX, private);
return 0;
}
@@ -137,7 +137,7 @@ __condvar_acquire_lock (pthread_cond_t *cond, int private)
}
/* TODO Back off. */
}
- futex_wait_simple (&cond->__data.__g1_orig_size,
+ __futex_wait_simple (&cond->__data.__g1_orig_size,
(s & ~(unsigned int) 3) | 2, private);
/* Reload so we see a recent value. */
s = atomic_load_relaxed (&cond->__data.__g1_orig_size);
@@ -151,7 +151,7 @@ __condvar_release_lock (pthread_cond_t *cond, int private)
if ((atomic_fetch_and_release (&cond->__data.__g1_orig_size,
~(unsigned int) 3) & 3)
== 2)
- futex_wake (&cond->__data.__g1_orig_size, 1, private);
+ __futex_wake_internal (&cond->__data.__g1_orig_size, 1, private);
}
/* Only use this when having acquired the lock. */
@@ -50,7 +50,7 @@ __pthread_cond_destroy (pthread_cond_t *cond)
int private = __condvar_get_private (wrefs);
while (wrefs >> 3 != 0)
{
- futex_wait_simple (&cond->__data.__wrefs, wrefs, private);
+ __futex_wait_simple (&cond->__data.__wrefs, wrefs, private);
/* See above. */
wrefs = atomic_load_acquire (&cond->__data.__wrefs);
}
@@ -89,7 +89,7 @@ ___pthread_cond_signal (pthread_cond_t *cond)
__condvar_release_lock (cond, private);
if (do_futex_wake)
- futex_wake (cond->__data.__g_signals + g1, 1, private);
+ __futex_wake_internal (cond->__data.__g_signals + g1, 1, private);
return 0;
}
@@ -51,7 +51,7 @@ __condvar_confirm_wakeup (pthread_cond_t *cond, int private)
threads waiting in pthread_cond_destroy. Release MO to synchronize with
these threads. Don't bother clearing the wake-up request flag. */
if ((atomic_fetch_add_release (&cond->__data.__wrefs, -8) >> 2) == 3)
- futex_wake (&cond->__data.__wrefs, INT_MAX, private);
+ __futex_wake_internal (&cond->__data.__wrefs, INT_MAX, private);
}
@@ -161,7 +161,7 @@ __condvar_cleanup_waiting (void *arg)
causing another waiter in the same group to not wake up. To work around
this issue until we have fixed cancellation, just add a futex wake-up
conservatively. */
- futex_wake (cond->__data.__g_signals + g, 1, cbuffer->private);
+ __futex_wake_internal (cond->__data.__g_signals + g, 1, cbuffer->private);
__condvar_confirm_wakeup (cond, cbuffer->private);
@@ -511,7 +511,7 @@ ___pthread_cond_clockwait64 (pthread_cond_t *cond, pthread_mutex_t *mutex,
if (! valid_nanoseconds (abstime->tv_nsec))
return EINVAL;
- if (!futex_abstimed_supported_clockid (clockid))
+ if (!__futex_abstimed_supported_clockid (clockid))
return EINVAL;
return __pthread_cond_wait_common (cond, mutex, clockid, abstime);
@@ -428,7 +428,7 @@ start_thread (void *arg)
/* Allow setxid from now onwards. */
if (__glibc_unlikely (atomic_exchange_acquire (&pd->setxid_futex, 0) == -2))
- futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
+ __futex_wake_internal (&pd->setxid_futex, 1, FUTEX_PRIVATE);
if (__glibc_likely (! not_first_call))
{
@@ -562,7 +562,7 @@ start_thread (void *arg)
this->__list.__next = NULL;
atomic_fetch_or_acquire (&this->__lock, FUTEX_OWNER_DIED);
- futex_wake ((unsigned int *) &this->__lock, 1,
+ __futex_wake_internal ((unsigned int *) &this->__lock, 1,
/* XYZ */ FUTEX_SHARED);
}
while (robust != (void *) &pd->robust_head);
@@ -582,11 +582,11 @@ start_thread (void *arg)
/* Some other thread might call any of the setXid functions and expect
us to reply. In this case wait until we did that. */
do
- /* XXX This differs from the typical futex_wait_simple pattern in that
+ /* XXX This differs from the typical __futex_wait_simple pattern in that
the futex_wait condition (setxid_futex) is different from the
condition used in the surrounding loop (cancelhandling). We need
to check and document why this is correct. */
- futex_wait_simple (&pd->setxid_futex, 0, FUTEX_PRIVATE);
+ __futex_wait_simple (&pd->setxid_futex, 0, FUTEX_PRIVATE);
while (pd->cancelhandling & SETXID_BITMASK);
/* Reset the value so that the stack can be reused. */
@@ -35,7 +35,7 @@ __pthread_clockjoin_ex (pthread_t threadid, void **thread_return,
/* Make sure the clock and time specified are valid. */
if (abstime
- && __glibc_unlikely (!futex_abstimed_supported_clockid (clockid)
+ && __glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)
|| ! valid_nanoseconds (abstime->tv_nsec)))
return EINVAL;
@@ -41,7 +41,7 @@ prio_inherit_missing (void)
static int tpi_supported;
if (__glibc_unlikely (atomic_load_relaxed (&tpi_supported) == 0))
{
- int e = futex_unlock_pi (&(unsigned int){0}, 0);
+ int e = __futex_unlock_pi (&(unsigned int){0}, 0);
atomic_store_relaxed (&tpi_supported, e == ENOSYS ? -1 : 1);
}
return __glibc_unlikely (tpi_supported < 0);
@@ -308,7 +308,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
assume_other_futex_waiters |= FUTEX_WAITERS;
/* Block using the futex and reload current lock value. */
- futex_wait ((unsigned int *) &mutex->__data.__lock, oldval,
+ __futex_wait_internal ((unsigned int *) &mutex->__data.__lock, oldval,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
oldval = mutex->__data.__lock;
}
@@ -472,7 +472,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
- futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+ __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
/* To the kernel, this will be visible after the kernel has
@@ -570,7 +570,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
break;
if (oldval != ceilval)
- futex_wait ((unsigned int * ) &mutex->__data.__lock,
+ __futex_wait_internal ((unsigned int * ) &mutex->__data.__lock,
ceilval | 2,
PTHREAD_MUTEX_PSHARED (mutex));
}
@@ -84,7 +84,7 @@ __pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling,
break;
if (oldval != ceilval)
- futex_wait ((unsigned int *) &mutex->__data.__lock, ceilval | 2,
+ __futex_wait_internal ((unsigned int *) &mutex->__data.__lock, ceilval | 2,
PTHREAD_MUTEX_PSHARED (mutex));
}
while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
@@ -115,7 +115,7 @@ __pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling,
| (prioceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT);
atomic_full_barrier ();
- futex_wake ((unsigned int *)&mutex->__data.__lock, INT_MAX,
+ __futex_wake_internal ((unsigned int *)&mutex->__data.__lock, INT_MAX,
PTHREAD_MUTEX_PSHARED (mutex));
return 0;
@@ -407,7 +407,7 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
- futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+ __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
/* To the kernel, this will be visible after the kernel has
@@ -553,7 +553,7 @@ ___pthread_mutex_clocklock64 (pthread_mutex_t *mutex,
clockid_t clockid,
const struct __timespec64 *abstime)
{
- if (__glibc_unlikely (!futex_abstimed_supported_clockid (clockid)))
+ if (__glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)))
return EINVAL;
LIBC_PROBE (mutex_clocklock_entry, 3, mutex, clockid, abstime);
@@ -330,7 +330,7 @@ ___pthread_mutex_trylock (pthread_mutex_t *mutex)
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
- futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+ __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
/* To the kernel, this will be visible after the kernel has
@@ -163,7 +163,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
private = PTHREAD_ROBUST_MUTEX_PSHARED (mutex);
if (__glibc_unlikely ((atomic_exchange_release (&mutex->__data.__lock, 0)
& FUTEX_WAITERS) != 0))
- futex_wake ((unsigned int *) &mutex->__data.__lock, 1, private);
+ __futex_wake_internal ((unsigned int *) &mutex->__data.__lock, 1, private);
/* We must clear op_pending after we release the mutex.
FIXME However, this violates the mutex destruction requirements
@@ -279,7 +279,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
if (((l & FUTEX_WAITERS) != 0)
|| (l != THREAD_GETMEM (THREAD_SELF, tid)))
{
- futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+ __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
private);
break;
}
@@ -333,7 +333,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
&oldval, newval));
if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)
- futex_wake ((unsigned int *)&mutex->__data.__lock, 1,
+ __futex_wake_internal ((unsigned int *)&mutex->__data.__lock, 1,
PTHREAD_MUTEX_PSHARED (mutex));
int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
@@ -35,7 +35,7 @@ clear_once_control (void *arg)
get interrupted (see __pthread_once), so all we need to relay to other
threads is the state being reset again. */
atomic_store_relaxed (once_control, 0);
- futex_wake ((unsigned int *) once_control, INT_MAX, FUTEX_PRIVATE);
+ __futex_wake_internal ((unsigned int *) once_control, INT_MAX, FUTEX_PRIVATE);
}
@@ -102,7 +102,7 @@ __pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))
{
/* Same generation, some other thread was faster. Wait and
retry. */
- futex_wait_simple ((unsigned int *) once_control,
+ __futex_wait_simple ((unsigned int *) once_control,
(unsigned int) newval, FUTEX_PRIVATE);
continue;
}
@@ -124,7 +124,7 @@ __pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))
atomic_store_release (once_control, __PTHREAD_ONCE_DONE);
/* Wake up all other threads. */
- futex_wake ((unsigned int *) once_control, INT_MAX, FUTEX_PRIVATE);
+ __futex_wake_internal ((unsigned int *) once_control, INT_MAX, FUTEX_PRIVATE);
break;
}
@@ -263,11 +263,11 @@ __pthread_rwlock_rdunlock (pthread_rwlock_t *rwlock)
atomic_thread_fence_acquire ();
if ((atomic_exchange_relaxed (&rwlock->__data.__wrphase_futex, 1)
& PTHREAD_RWLOCK_FUTEX_USED) != 0)
- futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+ __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
}
/* Also wake up waiting readers if we did reset the RWAITING flag. */
if ((r & PTHREAD_RWLOCK_RWAITING) != (rnew & PTHREAD_RWLOCK_RWAITING))
- futex_wake (&rwlock->__data.__readers, INT_MAX, private);
+ __futex_wake_internal (&rwlock->__data.__readers, INT_MAX, private);
}
@@ -283,7 +283,7 @@ __pthread_rwlock_rdlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
requires that "the validity of the abstime parameter need not be checked
if the lock can be immediately acquired" (i.e., we need not but may check
it). */
- if (abstime && __glibc_unlikely (!futex_abstimed_supported_clockid (clockid)
+ if (abstime && __glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)
|| ! valid_nanoseconds (abstime->tv_nsec)))
return EINVAL;
@@ -408,7 +408,7 @@ __pthread_rwlock_rdlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
& PTHREAD_RWLOCK_FUTEX_USED) != 0)
{
int private = __pthread_rwlock_get_private (rwlock);
- futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+ __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
}
return 0;
}
@@ -568,13 +568,13 @@ __pthread_rwlock_wrunlock (pthread_rwlock_t *rwlock)
established through __readers. */
if ((atomic_exchange_relaxed (&rwlock->__data.__wrphase_futex, 0)
& PTHREAD_RWLOCK_FUTEX_USED) != 0)
- futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+ __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
}
done:
/* We released WRLOCKED in some way, so wake a writer. */
if (wake_writers)
- futex_wake (&rwlock->__data.__writers_futex, 1, private);
+ __futex_wake_internal (&rwlock->__data.__writers_futex, 1, private);
}
@@ -588,7 +588,7 @@ __pthread_rwlock_wrlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
requires that "the validity of the abstime parameter need not be checked
if the lock can be immediately acquired" (i.e., we need not but may check
it). */
- if (abstime && __glibc_unlikely (!futex_abstimed_supported_clockid (clockid)
+ if (abstime && __glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)
|| ! valid_nanoseconds (abstime->tv_nsec)))
return EINVAL;
@@ -853,7 +853,7 @@ __pthread_rwlock_wrlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
{
/* Wake other writers. */
if ((wf & PTHREAD_RWLOCK_FUTEX_USED) != 0)
- futex_wake (&rwlock->__data.__writers_futex,
+ __futex_wake_internal (&rwlock->__data.__writers_futex,
1, private);
return err;
}
@@ -895,11 +895,11 @@ __pthread_rwlock_wrlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
{
/* Wake other writers. */
if ((wf & PTHREAD_RWLOCK_FUTEX_USED) != 0)
- futex_wake (&rwlock->__data.__writers_futex,
+ __futex_wake_internal (&rwlock->__data.__writers_futex,
1, private);
/* Wake waiting readers. */
if ((r & PTHREAD_RWLOCK_RWAITING) != 0)
- futex_wake (&rwlock->__data.__readers,
+ __futex_wake_internal (&rwlock->__data.__readers,
INT_MAX, private);
return ETIMEDOUT;
}
@@ -107,7 +107,7 @@ ___pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
& PTHREAD_RWLOCK_FUTEX_USED) != 0)
{
int private = __pthread_rwlock_get_private (rwlock);
- futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+ __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
}
}
@@ -28,7 +28,7 @@ ___sem_clockwait64 (sem_t *sem, clockid_t clockid,
{
/* Check that supplied clockid is one we support, even if we don't end up
waiting. */
- if (!futex_abstimed_supported_clockid (clockid))
+ if (!__futex_abstimed_supported_clockid (clockid))
{
__set_errno (EINVAL);
return -1;
@@ -53,7 +53,7 @@ __new_sem_post (sem_t *sem)
/* If there is any potentially blocked waiter, wake one of them. */
if ((d >> SEM_NWAITERS_SHIFT) > 0)
- futex_wake (((unsigned int *) &isem->data) + SEM_VALUE_OFFSET, 1, private);
+ __futex_wake_internal (((unsigned int *) &isem->data) + SEM_VALUE_OFFSET, 1, private);
#else
/* Add a token to the semaphore. Similar to 64b version. */
unsigned int v = atomic_load_relaxed (&isem->value);
@@ -70,7 +70,7 @@ __new_sem_post (sem_t *sem)
/* If there is any potentially blocked waiter, wake one of them. */
if ((v & SEM_NWAITERS_MASK) != 0)
- futex_wake (&isem->value, 1, private);
+ __futex_wake_internal (&isem->value, 1, private);
#endif
return 0;
@@ -93,7 +93,7 @@ __old_sem_post (sem_t *sem)
atomic_write_barrier ();
atomic_fetch_add_release (futex, 1);
/* We always have to assume it is a shared semaphore. */
- futex_wake (futex, 1, LLL_SHARED);
+ __futex_wake_internal (futex, 1, LLL_SHARED);
return 0;
}
compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);
@@ -352,7 +352,7 @@ __sem_wait_32_finish (struct new_sem *sem)
due to us having set the nwaiters bit again. */
v >>= SEM_VALUE_SHIFT;
if (v > 0)
- futex_wake (&sem->value, v, sem->private);
+ __futex_wake_internal (&sem->value, v, sem->private);
}
}
#endif
@@ -29,7 +29,7 @@
#define AIO_MISC_NOTIFY(waitlist) \
do { \
if (*waitlist->counterp > 0 && --*waitlist->counterp == 0) \
- futex_wake ((unsigned int *) waitlist->counterp, 1, FUTEX_PRIVATE); \
+ __futex_wake_internal ((unsigned int *) waitlist->counterp, 1, FUTEX_PRIVATE); \
} while (0)
#define AIO_MISC_WAIT(result, futex, timeout, cancel) \
@@ -48,7 +48,7 @@ __thread_gscope_wait (void)
continue;
do
- futex_wait_simple ((unsigned int *) gscope_flagp,
+ __futex_wait_simple ((unsigned int *) gscope_flagp,
THREAD_GSCOPE_FLAG_WAIT, FUTEX_PRIVATE);
while (*gscope_flagp == THREAD_GSCOPE_FLAG_WAIT);
}
@@ -71,7 +71,7 @@ __thread_gscope_wait (void)
continue;
do
- futex_wait_simple ((unsigned int *) gscope_flagp,
+ __futex_wait_simple ((unsigned int *) gscope_flagp,
THREAD_GSCOPE_FLAG_WAIT, FUTEX_PRIVATE);
while (*gscope_flagp == THREAD_GSCOPE_FLAG_WAIT);
}
@@ -76,7 +76,7 @@
/* Calls __libc_fatal with an error message. Convenience function for
concrete implementations of the futex interface. */
static __always_inline __attribute__ ((__noreturn__)) void
-futex_fatal_error (void)
+__futex_fatal_error (void)
{
__libc_fatal ("The futex facility returned an unexpected error code.\n");
}
@@ -121,7 +121,7 @@ futex_fatal_error (void)
a futex_wait call when synchronizing similar to Dekker synchronization.
However, we make no such guarantee here. */
static __always_inline int
-futex_wait (unsigned int *futex_word, unsigned int expected, int private)
+__futex_wait_internal (unsigned int *futex_word, unsigned int expected, int private)
{
int err = lll_futex_timed_wait (futex_word, expected, NULL, private);
switch (err)
@@ -139,7 +139,7 @@ futex_wait (unsigned int *futex_word, unsigned int expected, int private)
case -ENOSYS: /* Must have been caused by a glibc bug. */
/* No other errors are documented at this time. */
default:
- futex_fatal_error ();
+ __futex_fatal_error ();
}
}
@@ -148,19 +148,19 @@ futex_wait (unsigned int *futex_word, unsigned int expected, int private)
determine whether you need to continue waiting, and you cannot detect
whether the waiting was interrupted by a signal. Example use:
while (atomic_load_relaxed (&futex_word) == 23)
- futex_wait_simple (&futex_word, 23, FUTEX_PRIVATE);
+ __futex_wait_simple (&futex_word, 23, FUTEX_PRIVATE);
This is common enough to make providing this wrapper worthwhile. */
static __always_inline void
-futex_wait_simple (unsigned int *futex_word, unsigned int expected,
+__futex_wait_simple (unsigned int *futex_word, unsigned int expected,
int private)
{
- ignore_value (futex_wait (futex_word, expected, private));
+ ignore_value (__futex_wait_internal (futex_word, expected, private));
}
/* Check whether the specified clockid is supported by
futex_abstimed_wait and futex_abstimed_wait_cancelable. */
static __always_inline int
-futex_abstimed_supported_clockid (clockid_t clockid)
+__futex_abstimed_supported_clockid (clockid_t clockid)
{
return lll_futex_supported_clockid (clockid);
}
@@ -174,7 +174,7 @@ futex_abstimed_supported_clockid (clockid_t clockid)
for (res = 0; PROCESSES_TO_WAKE > 0; PROCESSES_TO_WAKE--, res++) {
if (<no process blocked on futex>) break;
wf = <get wait_flag of a process blocked on futex> (FUTEX_WORD);
- // No happens-before guarantee with woken futex_wait (see above)
+ // No happens-before guarantee with woken __futex_wait_internal (see above)
atomic_store_relaxed (wf, 0);
}
return res;
@@ -184,7 +184,7 @@ futex_abstimed_supported_clockid (clockid_t clockid)
object destruction (see above); therefore, we must not report or abort
on most errors. */
static __always_inline void
-futex_wake (unsigned int* futex_word, int processes_to_wake, int private)
+__futex_wake_internal (unsigned int* futex_word, int processes_to_wake, int private)
{
int res = lll_futex_wake (futex_word, processes_to_wake, private);
/* No error. Ignore the number of woken processes. */
@@ -202,7 +202,7 @@ futex_wake (unsigned int* futex_word, int processes_to_wake, int private)
case -ENOSYS: /* Must have been caused by a glibc bug. */
/* No other errors are documented at this time. */
default:
- futex_fatal_error ();
+ __futex_fatal_error ();
}
}
@@ -240,7 +240,7 @@ int __futex_lock_pi64 (int *futex_word, clockid_t clockid,
additionally, returns EPERM when the caller is not allowed to attach
itself to the futex. */
static __always_inline int
-futex_unlock_pi (unsigned int *futex_word, int private)
+__futex_unlock_pi (unsigned int *futex_word, int private)
{
int err = lll_futex_timed_unlock_pi (futex_word, private);
switch (err)
@@ -263,7 +263,7 @@ futex_unlock_pi (unsigned int *futex_word, int private)
case -EFAULT: /* Must have been caused by a glibc or application bug. */
/* No other errors are documented at this time. */
default:
- futex_fatal_error ();
+ __futex_fatal_error ();
}
}
@@ -30,7 +30,7 @@
#define GAI_MISC_NOTIFY(waitlist) \
do { \
if (*waitlist->counterp > 0 && --*waitlist->counterp == 0) \
- futex_wake ((unsigned int *) waitlist->counterp, 1, FUTEX_PRIVATE); \
+ __futex_wake_internal ((unsigned int *) waitlist->counterp, 1, FUTEX_PRIVATE); \
} while (0)
#define GAI_MISC_WAIT(result, futex, timeout, cancel) \
@@ -72,7 +72,7 @@ __libc_start_call_main (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
internal_signal_block_all (&set);
struct pthread *self = THREAD_SELF;
atomic_store_release (&self->joinstate, THREAD_STATE_EXITED);
- futex_wake (&self->joinstate, 1, FUTEX_SHARED);
+ __futex_wake_internal (&self->joinstate, 1, FUTEX_SHARED);
if (atomic_fetch_add_relaxed (&__nptl_nthreads, -1) != 1)
/* Not much left to do but to exit the thread, not the process. */
@@ -98,7 +98,7 @@
...
563 if ((atomic_exchange_relaxed (&rwlock->__data.__wrphase_futex, 0)
564 & PTHREAD_RWLOCK_FUTEX_USED) != 0)
- 565 futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+ 565 __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
566 }
We note that PTHREAD_RWLOCK_FUTEX_USED is non-zero