diff options
| author | chai <chaifix@163.com> | 2019-06-06 00:12:17 +0800 |
|---|---|---|
| committer | chai <chaifix@163.com> | 2019-06-06 00:12:17 +0800 |
| commit | 8bfe54676f728076a92d802bb5d064e58265c8f2 (patch) | |
| tree | 5d8ea1bd063f2d01dc979915db546449d68277bf /source/libs/asura-lib-utils/threading/semaphore.h | |
| parent | 88b882ed0b432c6aff2063213e2f793a36dd25f7 (diff) | |
-文件夹名
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 |
