1 //========================================================================
5 // Portable mutex macros.
7 // Copyright 2002-2003 Glyph & Cog, LLC
9 //========================================================================
20 // ... critical section ...
29 typedef CRITICAL_SECTION GMutex;
31 #define gInitMutex(m) InitializeCriticalSection(m)
32 #define gDestroyMutex(m) DeleteCriticalSection(m)
33 #define gLockMutex(m) EnterCriticalSection(m)
34 #define gUnlockMutex(m) LeaveCriticalSection(m)
36 #else // assume pthreads
40 typedef pthread_mutex_t GMutex;
42 #define gInitMutex(m) pthread_mutex_init(m, NULL)
43 #define gDestroyMutex(m) pthread_mutex_destroy(m)
44 #define gLockMutex(m) pthread_mutex_lock(m)
45 #define gUnlockMutex(m) pthread_mutex_unlock(m)