#ifndef GLTB_SEMAPHORE_H_ #define GLTB_SEMAPHORE_H_ #ifdef WIN32 #include #else #include #endif #include "GLTB/referencedobject.h" #include "GLTB/refptr.h" namespace gltb { class Semaphore : public ReferencedObject { private: Semaphore(int maxCount, int initialCount); public: virtual ~Semaphore(); void signal(); void wait(); bool wait(int timeout); static RefPtr createSemaphore(int maxCount=1, int initialCount=0); private: #ifdef WIN32 HANDLE semaphoreHandle; #else sem_t semaphore; #endif }; } #endif