1 #include "pthread_impl.h"
3 int pthread_mutex_trylock(pthread_mutex_t *m)
6 if (m->_m_type != PTHREAD_MUTEX_NORMAL) {
8 if (m->_m_type == PTHREAD_MUTEX_RECURSIVE
9 && m->_m_owner == self->tid) {
10 if ((unsigned)m->_m_count >= INT_MAX) return EAGAIN;
16 if (a_xchg(&m->_m_lock, 1))
17 if (m->_m_type == PTHREAD_MUTEX_ERRORCHECK
18 && m->_m_owner == self->tid) return EDEADLK;
20 if (m->_m_type != PTHREAD_MUTEX_NORMAL) {
21 m->_m_owner = self->tid;