diff options
Diffstat (limited to 'Source/Library/Common/Mutex.class.h')
-rw-r--r-- | Source/Library/Common/Mutex.class.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/Library/Common/Mutex.class.h b/Source/Library/Common/Mutex.class.h new file mode 100644 index 0000000..1e3f63d --- /dev/null +++ b/Source/Library/Common/Mutex.class.h @@ -0,0 +1,21 @@ +#ifndef DEF_MUTEX_CLASS_H +#define DEF_MUTEX_CLASS_H + +#include <common.h> + +#define MUTEX_FALSE 0 +#define MUTEX_TRUE 1 + +class Mutex { + private: + u32int m_locked; + + public: + Mutex(u32int locked = MUTEX_FALSE); + bool lock(); //Locks the mutex if it is not locked. Returns true if mutex could be locked, false if already locked + void waitLock(); //Locks the mutex, waiting for it to be unlocked before if necessary + void unlock(); + bool locked(); +}; + +#endif |