fix build with recent changes/gcc 6.3.0
[AROS-Contrib.git] / arospdf / goo / GMutex.h
blob7fa93d85e06c4da8971e255edc63f856182b9ccb
1 //========================================================================
2 //
3 // GMutex.h
4 //
5 // Portable mutex macros.
6 //
7 // Copyright 2002-2003 Glyph & Cog, LLC
8 //
9 //========================================================================
11 #ifndef GMUTEX_H
12 #define GMUTEX_H
14 // Usage:
16 // GMutex m;
17 // gInitMutex(&m);
18 // ...
19 // gLockMutex(&m);
20 // ... critical section ...
21 // gUnlockMutex(&m);
22 // ...
23 // gDestroyMutex(&m);
25 #ifdef WIN32
27 #include <windows.h>
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
38 #include <pthread.h>
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)
47 #endif
49 #endif