header file: pthread.h
int pthread_mutex_trylock(pthread_mutex_t *mutex);
DWORD WINAPI WaitForSingleObject(
__in HANDLE hHandle,
__in DWORD dwMilliseconds
The pthread_mutex_trylock function is used to acquire a lock on
the specified mutex variable. If the mutex has already been
acquired by another thread, the function will return with an EBUSY
indication rather than blocking.
To achieve the same functionality in the Windows threading model
set the Milliseconds parameter to zero for the WaitForSingleObject
call. You will receive a WAIT_TIMEOUT indication if the mutex was
not signaled when you invoked the function.