fix and overhaul dlsym depedency order, always record direct deps
[musl.git] / src / thread / mtx_trylock.c
blob40a8b8c2977212c3006b91f5072be3a514beb5b2
1 #include "pthread_impl.h"
2 #include <threads.h>
4 int mtx_trylock(mtx_t *m)
6 if (m->_m_type == PTHREAD_MUTEX_NORMAL)
7 return (a_cas(&m->_m_lock, 0, EBUSY) & EBUSY) ? thrd_busy : thrd_success;
9 int ret = __pthread_mutex_trylock((pthread_mutex_t *)m);
10 switch (ret) {
11 default: return thrd_error;
12 case 0: return thrd_success;
13 case EBUSY: return thrd_busy;