5 int mtx_lock(mtx_t *mtx)
7 DWORD myId = GetCurrentThreadId();
9 if(mtx->_ThreadId == (long) myId) {
15 LONG prev = InterlockedCompareExchange(&mtx->_ThreadId, myId, 0);
19 DWORD rv = WaitForSingleObject(mtx->_WaitEvHandle, INFINITE);
20 if(rv != WAIT_OBJECT_0)
27 #include "_PDCLIB_test.h"