summaryrefslogtreecommitdiff
path: root/source/api_wrappers/linux/CSemaphore.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/api_wrappers/linux/CSemaphore.h')
-rw-r--r--source/api_wrappers/linux/CSemaphore.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/api_wrappers/linux/CSemaphore.h b/source/api_wrappers/linux/CSemaphore.h
new file mode 100644
index 0000000..24af4ad
--- /dev/null
+++ b/source/api_wrappers/linux/CSemaphore.h
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (C) ST-Ericsson SA 2011
+ * License terms: 3-clause BSD license
+ ******************************************************************************/
+
+#ifndef _CSEMAPHORE_H
+#define _CSEMAPHORE_H
+
+#include <pthread.h>
+#include <semaphore.h>
+#include "CWaitableObject.h"
+
+class CSemaphore : public CWaitableObject
+{
+public:
+ CSemaphore(unsigned int initial_count = 0);
+ virtual ~CSemaphore();
+ bool Release(unsigned int count = 1);
+ DWORD Wait(DWORD timeout = INFINITE);
+
+private:
+ sem_t m_semaphore;
+};
+
+#endif /* _CSEMAPHORE_H */
+