Files
zig/lib/libc/musl/src/thread/mtx_lock.c
Andrew Kelley 49d1a4c562 move lib dirs to lib subdir
also start prefering NtDll API. so far:
 * NtQueryInformationFile
 * NtClose

adds a performance workaround for windows unicode conversion. but that
should probably be removed before merging
2019-07-15 17:54:50 -04:00

13 lines
351 B
C
Vendored

#include "pthread_impl.h"
#include <threads.h>
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.
* It is convenient, here to avoid duplication of the logic
* for return values. */
return mtx_timedlock(m, 0);
}