#include "pthread_impl.h" #include int mtx_lock(mtx_t *m) { if (m->_m_type == PTHREAD_MUTEX_NORMAL && !a_cas(&m->_m_lock, 0, EBUSY)) return thrd_success; /* Calling mtx_timedlock with a null pointer is an extension. Such a call is convenient, here, since it avoids to repeat the case analysis that is already done for mtx_timedlock. */ return mtx_timedlock(m, 0); }