medfall

A super great game engine
Log | Files | Refs

commit 9896b5052d524f37f094918fceaeb8947327862e
parent 5772d6e733225cdbed8168e0e4f9ce7eaa44c9e4
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat, 26 May 2018 18:36:57 +0300

Use SRWLOCK instead of CRITICAL_SECTION on Windows

Diffstat:
win32_mutex.h | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/win32_mutex.h b/win32_mutex.h @@ -5,21 +5,19 @@ #include "log.h" struct Mutex { - CRITICAL_SECTION cs; + SRWLOCK lock; }; inline void mutex_init( Mutex * mutex ) { - InitializeCriticalSection( &mutex->cs ); + InitializeSRWLock( &mutex->lock ); } -inline void mutex_destroy( Mutex * mutex ) { - DeleteCriticalSection( &mutex->cs ); -} +inline void mutex_destroy( Mutex * mutex ) { } inline void mutex_lock( Mutex * mutex ) { - EnterCriticalSection( &mutex->cs ); + AcquireSRWLockExclusive( &mutex->lock ); } inline void mutex_unlock( Mutex * mutex ) { - LeaveCriticalSection( &mutex->cs ); + ReleaseSRWLockExclusive( &mutex->lock ); }