commit 7913634c1e8ac9980230d9d00b9343aff8c4d41b parent dc44416f2df4d85e2ef37b769d2a6f297cafa6b4 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Dec 18 23:13:57 +0200 Oops Diffstat:
win32_mutex.h | | | 9 | ++++----- |
diff --git a/win32_mutex.h b/win32_mutex.h @@ -10,9 +10,8 @@ struct Mutex { inline void mutex_init( Mutex * mutex ) { mutex->mutex = CreateMutex( NULL, FALSE, NULL ); - int ok = pthread_mutex_init( &mutex->mutex, NULL ); - if( ok != 0 ) { - err( 1, "pthread_mutex_init: %d", ok ); + if( mutex->mutex == NULL ) { + FATAL( "CreateMutex failed" ); } } @@ -23,13 +22,13 @@ inline void mutex_destroy( Mutex * mutex ) { } inline void mutex_lock( Mutex * mutex ) { - if( WaitForSingleObject( sem->sem, INFINITE ) == WAIT_FAILED ) { + if( WaitForSingleObject( mutex->mutex, INFINITE ) == WAIT_FAILED ) { FATAL( "WaitForSingleObject failed" ); } } inline bool mutex_trylock( Mutex * mutex ) { - DWORD ok = WaitForSingleObject( sem->sem, 0 ); + DWORD ok = WaitForSingleObject( mutex->mutex, 0 ); if( ok == WAIT_FAILED ) FATAL( "WaitForSingleObject failed" ); if( ok == WAIT_TIMEOUT ) return false; return true;