1 #include "pthread_impl.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
);
11 default: return thrd_error
;
12 case 0: return thrd_success
;
13 case EBUSY
: return thrd_busy
;