summaryrefslogtreecommitdiff
path: root/source/modules/asura-utils/Threads/Semaphore.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-utils/Threads/Semaphore.h')
-rw-r--r--source/modules/asura-utils/Threads/Semaphore.h68
1 files changed, 0 insertions, 68 deletions
diff --git a/source/modules/asura-utils/Threads/Semaphore.h b/source/modules/asura-utils/Threads/Semaphore.h
deleted file mode 100644
index 41b1fd2..0000000
--- a/source/modules/asura-utils/Threads/Semaphore.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef _ASURA_SEMAPHORE_H_
-#define _ASURA_SEMAPHORE_H_
-
-#include "../UtilsConfig.h"
-
-#if ASURA_THREAD_WIN32
-#include <windows.h>
-#endif
-
-namespace_begin(AsuraEngine)
-namespace_begin(Threads)
-
-class SemaphoreImpl;
-
-///
-/// ź
-///
-class Semaphore
-{
-public:
-
- Semaphore(unsigned int init_count = 1);
- ~Semaphore();
-
- void Signal();
- bool Wait(int timeout = ASURA_MUTEX_MAXWAIT);
-
-private:
- SemaphoreImpl* m_Impl;
-};
-
-class SemaphoreImpl
-{
-public:
- SemaphoreImpl(unsigned int init_value)
- : m_Count(init_value)
- {
- };
- virtual ~SemaphoreImpl() {};
- virtual void Signal() = 0;
- virtual bool Wait(int timeout) = 0;
- inline int Current() { return m_Count; }
-protected:
- unsigned int m_Count;
-};
-
-#define wait(sem, ...) sem.Wait(__VA_ARGS__)
-#define signal(sem) sem.Signal()
-
-#if ASURA_THREAD_WIN32
-
-class SemaphoreWin32 : public SemaphoreImpl
-{
-public:
- SemaphoreWin32(unsigned int init_value);
- ~SemaphoreWin32();
- void Signal() override;
- bool Wait(int timeout) override;
-private:
- HANDLE m_Sem;
-};
-
-#endif // ASURA_THREAD_WIN32
-
-namespace_end
-namespace_end
-
-#endif \ No newline at end of file