1 #include "pthread_impl.h"
3 int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *at)
6 while ((r=pthread_mutex_trylock(m)) == EBUSY) {
7 if (!(r=m->_m_lock) || (r&0x40000000)) continue;
8 if (!w) a_inc(&m->_m_waiters), w++;
9 if (__timedwait(&m->_m_lock, r, CLOCK_REALTIME, at, 0) == ETIMEDOUT) {
10 if (w) a_dec(&m->_m_waiters);
14 if (w) a_dec(&m->_m_waiters);