mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-12 16:20:06 +00:00
nptl: Replace lll_futex_wake with futex-internal.h
The idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
parent
2a45be88ed
commit
b45b1c5ba1
@ -116,8 +116,8 @@ pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling,
|
|||||||
| (prioceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT);
|
| (prioceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT);
|
||||||
atomic_full_barrier ();
|
atomic_full_barrier ();
|
||||||
|
|
||||||
lll_futex_wake (&mutex->__data.__lock, INT_MAX,
|
futex_wake ((unsigned int *)&mutex->__data.__lock, INT_MAX,
|
||||||
PTHREAD_MUTEX_PSHARED (mutex));
|
PTHREAD_MUTEX_PSHARED (mutex));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
|
|||||||
private = PTHREAD_ROBUST_MUTEX_PSHARED (mutex);
|
private = PTHREAD_ROBUST_MUTEX_PSHARED (mutex);
|
||||||
if (__glibc_unlikely ((atomic_exchange_rel (&mutex->__data.__lock, 0)
|
if (__glibc_unlikely ((atomic_exchange_rel (&mutex->__data.__lock, 0)
|
||||||
& FUTEX_WAITERS) != 0))
|
& FUTEX_WAITERS) != 0))
|
||||||
lll_futex_wake (&mutex->__data.__lock, 1, private);
|
futex_wake ((unsigned int *) &mutex->__data.__lock, 1, private);
|
||||||
|
|
||||||
/* We must clear op_pending after we release the mutex.
|
/* We must clear op_pending after we release the mutex.
|
||||||
FIXME However, this violates the mutex destruction requirements
|
FIXME However, this violates the mutex destruction requirements
|
||||||
@ -332,8 +332,8 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
|
|||||||
&oldval, newval));
|
&oldval, newval));
|
||||||
|
|
||||||
if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)
|
if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)
|
||||||
lll_futex_wake (&mutex->__data.__lock, 1,
|
futex_wake ((unsigned int *)&mutex->__data.__lock, 1,
|
||||||
PTHREAD_MUTEX_PSHARED (mutex));
|
PTHREAD_MUTEX_PSHARED (mutex));
|
||||||
|
|
||||||
int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
|
int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
|
||||||
|
|
||||||
|
@ -84,19 +84,14 @@ int
|
|||||||
attribute_compat_text_section
|
attribute_compat_text_section
|
||||||
__old_sem_post (sem_t *sem)
|
__old_sem_post (sem_t *sem)
|
||||||
{
|
{
|
||||||
int *futex = (int *) sem;
|
unsigned int *futex = (unsigned int *) sem;
|
||||||
|
|
||||||
/* We must need to synchronize with consumers of this token, so the atomic
|
/* We must need to synchronize with consumers of this token, so the atomic
|
||||||
increment must have release MO semantics. */
|
increment must have release MO semantics. */
|
||||||
atomic_write_barrier ();
|
atomic_write_barrier ();
|
||||||
(void) atomic_increment_val (futex);
|
(void) atomic_increment_val (futex);
|
||||||
/* We always have to assume it is a shared semaphore. */
|
/* We always have to assume it is a shared semaphore. */
|
||||||
int err = lll_futex_wake (futex, 1, LLL_SHARED);
|
futex_wake (futex, 1, LLL_SHARED);
|
||||||
if (__builtin_expect (err, 0) < 0)
|
|
||||||
{
|
|
||||||
__set_errno (-err);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);
|
compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);
|
||||||
|
Loading…
Reference in New Issue
Block a user