1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include <endian.h>
- #include <errno.h>
- #include <sysdep.h>
- #include <lowlevellock.h>
- #include <pthread.h>
- #include <pthreadP.h>
- #include <bits/kernel-features.h>
- int
- attribute_protected
- __pthread_cond_signal (
- pthread_cond_t *cond)
- {
- int pshared = (cond->__data.__mutex == (void *) ~0l)
- ? LLL_SHARED : LLL_PRIVATE;
-
- lll_lock (cond->__data.__lock, pshared);
-
- if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
- {
-
- ++cond->__data.__wakeup_seq;
- ++cond->__data.__futex;
-
- if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex, 1,
- 1, &cond->__data.__lock,
- pshared), 0))
- return 0;
- lll_futex_wake (&cond->__data.__futex, 1, pshared);
- }
-
- lll_unlock (cond->__data.__lock, pshared);
- return 0;
- }
- weak_alias(__pthread_cond_signal, pthread_cond_signal)
|