diff options
Diffstat (limited to 'Runtime/Threads/Posix/PlatformMutex.h')
-rw-r--r-- | Runtime/Threads/Posix/PlatformMutex.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Runtime/Threads/Posix/PlatformMutex.h b/Runtime/Threads/Posix/PlatformMutex.h new file mode 100644 index 0000000..0071094 --- /dev/null +++ b/Runtime/Threads/Posix/PlatformMutex.h @@ -0,0 +1,29 @@ +#ifndef __PLATFORMMUTEX_H +#define __PLATFORMMUTEX_H + +#if SUPPORT_THREADS + +#include <pthread.h> +#include "Runtime/Utilities/NonCopyable.h" + +/** + * A platform/api specific mutex class. Always recursive (a single thread can lock multiple times). + */ +class PlatformMutex : public NonCopyable +{ + friend class Mutex; +protected: + PlatformMutex(); + ~PlatformMutex(); + + void Lock(); + void Unlock(); + bool TryLock(); + +private: + + pthread_mutex_t mutex; +}; + +#endif // SUPPORT_THREADS +#endif // __PLATFORMMUTEX_H |