diff options
author | Torvald Riegel <triegel@redhat.com> | 2014-11-25 19:48:56 +0100 |
---|---|---|
committer | Torvald Riegel <triegel@redhat.com> | 2014-11-26 10:07:20 +0100 |
commit | cdcb42d7f786fe5ee1ca60065924d0b5c6649dd0 (patch) | |
tree | 302e5e92ddcc5996250b9d5ee3ab578afaa128ef /nptl/pthread_mutexattr_setprioceiling.c | |
parent | c82f5c0ce5c1c0180fca311ceb29fd2d59da7441 (diff) | |
download | glibc-cdcb42d7f786fe5ee1ca60065924d0b5c6649dd0.tar glibc-cdcb42d7f786fe5ee1ca60065924d0b5c6649dd0.tar.gz glibc-cdcb42d7f786fe5ee1ca60065924d0b5c6649dd0.tar.bz2 glibc-cdcb42d7f786fe5ee1ca60065924d0b5c6649dd0.zip |
Fix synchronization of TPP min/max priorities.
* nptl/tpp.c (__init_sched_fifo_prio, __pthread_tpp_change_priority):
Change synchronization of __sched_fifo_min_prio and
__sched_fifo_max_prio.
* nptl/pthread_mutexattr_getprioceiling.c
(pthread_mutexattr_getprioceiling): Likewise.
* nptl/pthread_mutexattr_setprioceiling.c
(pthread_mutexattr_setprioceiling): Likewise.
* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
* nptl/pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling):
Likewise.
Diffstat (limited to 'nptl/pthread_mutexattr_setprioceiling.c')
-rw-r--r-- | nptl/pthread_mutexattr_setprioceiling.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/nptl/pthread_mutexattr_setprioceiling.c b/nptl/pthread_mutexattr_setprioceiling.c index d10e51cbfa..d155bf0fa8 100644 --- a/nptl/pthread_mutexattr_setprioceiling.c +++ b/nptl/pthread_mutexattr_setprioceiling.c @@ -19,6 +19,7 @@ #include <errno.h> #include <pthreadP.h> +#include <atomic.h> int @@ -26,15 +27,19 @@ pthread_mutexattr_setprioceiling (attr, prioceiling) pthread_mutexattr_t *attr; int prioceiling; { - if (__sched_fifo_min_prio == -1) + /* See __init_sched_fifo_prio. */ + if (atomic_load_relaxed (&__sched_fifo_min_prio) == -1 + || atomic_load_relaxed (&__sched_fifo_max_prio) == -1) __init_sched_fifo_prio (); - if (__builtin_expect (prioceiling < __sched_fifo_min_prio, 0) - || __builtin_expect (prioceiling > __sched_fifo_max_prio, 0) - || __builtin_expect ((prioceiling + if (__glibc_unlikely (prioceiling + < atomic_load_relaxed (&__sched_fifo_min_prio)) + || __glibc_unlikely (prioceiling + > atomic_load_relaxed (&__sched_fifo_max_prio)) + || __glibc_unlikely ((prioceiling & (PTHREAD_MUTEXATTR_PRIO_CEILING_MASK >> PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT)) - != prioceiling, 0)) + != prioceiling)) return EINVAL; struct pthread_mutexattr *iattr = (struct pthread_mutexattr *) attr; |