16 #error "orconfig.h didn't define WINVER"
19 #error "orconfig.h didn't define _WIN32_WINNT"
22 #error "winver too low"
24 #if _WIN32_WINNT < 0x0600
25 #error "winver too low"
43 InitializeSRWLock(&m->mutex);
48 m->type = NON_RECURSIVE;
49 InitializeSRWLock(&m->mutex);
61 LONG thread_id = GetCurrentThreadId();
63 LONG lock_owner = InterlockedCompareExchange(&m->lock_owner, 0, 0);
64 if (thread_id == lock_owner) {
68 AcquireSRWLockExclusive(&m->mutex);
69 InterlockedExchange(&m->lock_owner, thread_id);
76 AcquireSRWLockExclusive(&m->mutex);
83 if (m->type == NON_RECURSIVE) {
84 tor_mutex_acquire_nonrecursive(m);
86 tor_mutex_acquire_recursive(m);
93 if (--m->lock_count) {
96 InterlockedExchange(&m->lock_owner, 0);
97 ReleaseSRWLockExclusive(&m->mutex);
103 ReleaseSRWLockExclusive(&m->mutex);
109 if (m->type == NON_RECURSIVE) {
110 tor_mutex_release_nonrecursive(m);
112 tor_mutex_release_recursive(m);
Header for compat_mutex.c.
void tor_mutex_init_nonrecursive(tor_mutex_t *m)
void tor_mutex_release(tor_mutex_t *m)
void tor_mutex_init(tor_mutex_t *m)
void tor_mutex_acquire(tor_mutex_t *m)
void tor_locking_init(void)
void tor_mutex_uninit(tor_mutex_t *m)