Go to the documentation of this file.Go to the SVN repository for this file.
33 #include <freetds/thread.h>
35 #include "ptw32_MCS_lock.c"
40 if (!InterlockedExchangeAdd(&mutex->done, 0)) {
45 InitializeCriticalSection(&mutex->crit);
50 EnterCriticalSection(&mutex->crit);
51 mutex->thread_id = GetCurrentThreadId();
57 if (!mutex->done && !InterlockedExchangeAdd(&mutex->done, 0)) {
62 InitializeCriticalSection(&mutex->crit);
67 if (TryEnterCriticalSection(&mutex->crit)) {
68 DWORD thread_id = GetCurrentThreadId();
69 if (mutex->thread_id == thread_id) {
70 LeaveCriticalSection(&mutex->crit);
73 mutex->thread_id = thread_id;
static int tds_raw_mutex_trylock(tds_raw_mutex *mtx)
static void ptw32_mcs_lock_release(ptw32_mcs_local_node_t *node)
static void ptw32_mcs_lock_acquire(ptw32_mcs_lock_t *lock, ptw32_mcs_local_node_t *node)