summaryrefslogtreecommitdiff
path: root/Runtime/Threads/Posix/PlatformMutex.h
blob: 0071094086dfb7e08eff582da4fbd87fcd3fcae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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