diff options
Diffstat (limited to 'source/libs/asura-lib-utils/threading/semaphore.h')
-rw-r--r-- | source/libs/asura-lib-utils/threading/semaphore.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/source/libs/asura-lib-utils/threading/semaphore.h b/source/libs/asura-lib-utils/threading/semaphore.h deleted file mode 100644 index 80773d8..0000000 --- a/source/libs/asura-lib-utils/threading/semaphore.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __ASURA_SEMAPHORE_H__ -#define __ASURA_SEMAPHORE_H__ - -#include "../utils_config.h" - -#if ASURA_THREAD_WIN32 -#include <windows.h> -#endif - -namespace AsuraEngine -{ - namespace Threading - { - - class SemaphoreImpl; - - /// - /// ź - /// - class Semaphore - { - public: - - Semaphore(unsigned int init_count = 1); - ~Semaphore(); - - void Signal(); - void Wait(int timeout = 0); - - private: - SemaphoreImpl* mImpl; - }; - - class SemaphoreImpl - { - public: - SemaphoreImpl(unsigned int init_value) - : mCount(init_value) - { - }; - virtual ~SemaphoreImpl() {}; - virtual void Signal() = 0; - virtual bool Wait(int timeout) = 0; - inline int Current() { return mCount; } - protected: - unsigned int mCount; - }; - -#define wait(sem) sem.Wait(); -#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 mSem; - }; - -#endif // ASURA_THREAD_WIN32 - - } -} - -#endif
\ No newline at end of file |