medfall

A super great game engine
Log | Files | Refs

win32_mutex.h (392B)


      1 #pragma once
      2 
      3 #include <windows.h>
      4 
      5 #include "log.h"
      6 
      7 struct Mutex {
      8 	SRWLOCK lock;
      9 };
     10 
     11 inline void mutex_init( Mutex * mutex ) {
     12 	InitializeSRWLock( &mutex->lock );
     13 }
     14 
     15 inline void mutex_destroy( Mutex * mutex ) { }
     16 
     17 inline void mutex_lock( Mutex * mutex ) {
     18 	AcquireSRWLockExclusive( &mutex->lock );
     19 }
     20 
     21 inline void mutex_unlock( Mutex * mutex ) {
     22 	ReleaseSRWLockExclusive( &mutex->lock );
     23 }