From 71ba48c4ffa9574f4482f594210df9d3a6085361 Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Fri, 23 Jul 2010 08:45:42 +0300 Subject: [PATCH] Always init pthread locks to NULL This is the only way to keep Windows and POSIX behaviour in sync, so better hardcode it. Signed-off-by: Marco Costalba --- src/lock.h | 4 ++-- src/search.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lock.h b/src/lock.h index e25a2234..f46f93d8 100644 --- a/src/lock.h +++ b/src/lock.h @@ -28,7 +28,7 @@ typedef pthread_mutex_t Lock; -# define lock_init(x, y) pthread_mutex_init(x, y) +# define lock_init(x) pthread_mutex_init(x, NULL) # define lock_grab(x) pthread_mutex_lock(x) # define lock_release(x) pthread_mutex_unlock(x) # define lock_destroy(x) pthread_mutex_destroy(x) @@ -41,7 +41,7 @@ typedef pthread_mutex_t Lock; #undef WIN32_LEAN_AND_MEAN typedef CRITICAL_SECTION Lock; -# define lock_init(x, y) InitializeCriticalSection(x) +# define lock_init(x) InitializeCriticalSection(x) # define lock_grab(x) EnterCriticalSection(x) # define lock_release(x) LeaveCriticalSection(x) # define lock_destroy(x) DeleteCriticalSection(x) diff --git a/src/search.cpp b/src/search.cpp index c959c75a..29b7c5f3 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -2470,8 +2470,8 @@ namespace { #endif // Initialize global locks - lock_init(&MPLock, NULL); - lock_init(&WaitLock, NULL); + lock_init(&MPLock); + lock_init(&WaitLock); #if !defined(_MSC_VER) pthread_cond_init(&WaitCond, NULL); @@ -2483,7 +2483,7 @@ namespace { // Initialize splitPoints[] locks for (i = 0; i < MAX_THREADS; i++) for (int j = 0; j < MAX_ACTIVE_SPLIT_POINTS; j++) - lock_init(&(threads[i].splitPoints[j].lock), NULL); + lock_init(&(threads[i].splitPoints[j].lock)); // Will be set just before program exits to properly end the threads AllThreadsShouldExit = false; -- 2.39.2