mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
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 <mcostalba@gmail.com>
This commit is contained in:
parent
65f8b6dbc0
commit
71ba48c4ff
2 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue