mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
Use glibc_likely instead __builtin_expect.
This commit is contained in:
@ -71,7 +71,7 @@ __pthread_mutex_lock (mutex)
|
||||
| PTHREAD_MUTEX_ELISION_FLAGS_NP), 0))
|
||||
return __pthread_mutex_lock_full (mutex);
|
||||
|
||||
if (__builtin_expect (type == PTHREAD_MUTEX_TIMED_NP, 1))
|
||||
if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_NP))
|
||||
{
|
||||
FORCE_ELISION (mutex, goto elision);
|
||||
simple:
|
||||
@ -80,7 +80,7 @@ __pthread_mutex_lock (mutex)
|
||||
assert (mutex->__data.__owner == 0);
|
||||
}
|
||||
#ifdef HAVE_ELISION
|
||||
else if (__builtin_expect (type == PTHREAD_MUTEX_TIMED_ELISION_NP, 1))
|
||||
else if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_ELISION_NP))
|
||||
{
|
||||
elision: __attribute__((unused))
|
||||
/* This case can never happen on a system without elision,
|
||||
@ -101,7 +101,7 @@ __pthread_mutex_lock (mutex)
|
||||
if (mutex->__data.__owner == id)
|
||||
{
|
||||
/* Just bump the counter. */
|
||||
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
||||
if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
|
||||
/* Overflow of the counter. */
|
||||
return EAGAIN;
|
||||
|
||||
@ -150,7 +150,7 @@ __pthread_mutex_lock (mutex)
|
||||
pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
|
||||
assert (PTHREAD_MUTEX_TYPE (mutex) == PTHREAD_MUTEX_ERRORCHECK_NP);
|
||||
/* Check whether we already hold the mutex. */
|
||||
if (__builtin_expect (mutex->__data.__owner == id, 0))
|
||||
if (__glibc_unlikely (mutex->__data.__owner == id))
|
||||
return EDEADLK;
|
||||
goto simple;
|
||||
}
|
||||
@ -229,7 +229,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
||||
}
|
||||
|
||||
/* Check whether we already hold the mutex. */
|
||||
if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
|
||||
if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
|
||||
{
|
||||
int kind = PTHREAD_MUTEX_TYPE (mutex);
|
||||
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
|
||||
@ -245,7 +245,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
||||
NULL);
|
||||
|
||||
/* Just bump the counter. */
|
||||
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
||||
if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
|
||||
/* Overflow of the counter. */
|
||||
return EAGAIN;
|
||||
|
||||
@ -296,7 +296,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
||||
oldval = mutex->__data.__lock;
|
||||
|
||||
/* Check whether we already hold the mutex. */
|
||||
if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
|
||||
if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
|
||||
{
|
||||
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
|
||||
{
|
||||
@ -309,7 +309,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
||||
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
||||
|
||||
/* Just bump the counter. */
|
||||
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
||||
if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
|
||||
/* Overflow of the counter. */
|
||||
return EAGAIN;
|
||||
|
||||
@ -359,7 +359,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
||||
assert (robust || (oldval & FUTEX_OWNER_DIED) == 0);
|
||||
}
|
||||
|
||||
if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
|
||||
if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
|
||||
{
|
||||
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
||||
|
||||
@ -427,7 +427,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
||||
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
|
||||
{
|
||||
/* Just bump the counter. */
|
||||
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
|
||||
if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
|
||||
/* Overflow of the counter. */
|
||||
return EAGAIN;
|
||||
|
||||
|
Reference in New Issue
Block a user