11 #ifndef MI_BASE_LOCK_H
12 #define MI_BASE_LOCK_H
16 #ifndef MI_PLATFORM_WINDOWS
19 #include <mi/base/miwindows.h>
38 #ifndef PTHREAD_MUTEX_ERRORCHECK
39 #define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP
49 #ifndef MI_PLATFORM_WINDOWS
50 inline Lock() { pthread_mutex_init(&m_mutex,NULL); };
52 inline Lock() { InitializeCriticalSection(&m_critical_section); };
56 #ifndef MI_PLATFORM_WINDOWS
57 inline ~Lock() { pthread_mutex_destroy(&m_mutex); };
59 inline ~Lock() { DeleteCriticalSection(&m_critical_section); };
100 #ifndef MI_PLATFORM_WINDOWS
101 void lock() { pthread_mutex_lock(&m_mutex); };
103 void lock() { EnterCriticalSection(&m_critical_section); };
107 #ifndef MI_PLATFORM_WINDOWS
108 void unlock() { pthread_mutex_unlock(&m_mutex); };
110 void unlock() { LeaveCriticalSection(&m_critical_section); };
122 #ifndef MI_PLATFORM_WINDOWS
123 pthread_mutex_t m_mutex;
125 CRITICAL_SECTION m_critical_section;
162 #endif // MI_BASE_LOCK_H