Commit c9f31a08 authored by Yoni Fogel's avatar Yoni Fogel

Closes #1338

windows pthread mutexes now require real initialization before use

git-svn-id: file:///svn/toku/tokudb.1032b@8400 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6370d5c9
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
int int
toku_pthread_mutex_init(toku_pthread_mutex_t *mutex, const toku_pthread_mutexattr_t *attr) { toku_pthread_mutex_init(toku_pthread_mutex_t *mutex, const toku_pthread_mutexattr_t *attr) {
assert(attr == NULL); assert(attr == NULL);
// assert(!mutex->initialized); assert(!mutex->initialized);
InitializeCriticalSection(&mutex->section); InitializeCriticalSection(&mutex->section);
mutex->initialized = TRUE; mutex->initialized = TRUE;
return 0; return 0;
...@@ -22,10 +22,6 @@ toku_pthread_mutex_destroy(toku_pthread_mutex_t *mutex) { ...@@ -22,10 +22,6 @@ toku_pthread_mutex_destroy(toku_pthread_mutex_t *mutex) {
int int
toku_pthread_mutex_lock(toku_pthread_mutex_t *mutex) { toku_pthread_mutex_lock(toku_pthread_mutex_t *mutex) {
if (!mutex->initialized) {
int r = toku_pthread_mutex_init(mutex, NULL);
assert(r==0);
}
assert(mutex->initialized); assert(mutex->initialized);
EnterCriticalSection(&mutex->section); EnterCriticalSection(&mutex->section);
return 0; return 0;
...@@ -34,6 +30,7 @@ toku_pthread_mutex_lock(toku_pthread_mutex_t *mutex) { ...@@ -34,6 +30,7 @@ toku_pthread_mutex_lock(toku_pthread_mutex_t *mutex) {
#if 0 #if 0
int int
toku_pthread_mutex_trylock(toku_pthread_mutex_t *mutex) { toku_pthread_mutex_trylock(toku_pthread_mutex_t *mutex) {
assert(mutex->initialized);
int r = 0; int r = 0;
if (!TryEnterCriticalSection(&mutex->section)) if (!TryEnterCriticalSection(&mutex->section))
r = EBUSY; r = EBUSY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment