CMCore/inc/hgl/thread/Semaphore.h

28 lines
947 B
C
Raw Normal View History

2019-08-19 19:19:58 +08:00
#ifndef HGL_SEMAPHORE_INCLUDE
#define HGL_SEMAPHORE_INCLUDE
2019-12-10 14:38:29 +08:00
#include<hgl/platform/Platform.h>
2019-08-19 19:19:58 +08:00
namespace hgl
{
/**
* 线<br>
*
*/
class Semaphore ///信号
{
2019-12-10 14:38:29 +08:00
semaphore_ptr ptr;
2019-08-19 19:19:58 +08:00
public:
Semaphore(int=1024);
virtual ~Semaphore();
virtual bool Post(int n=1); ///<发送信号
virtual bool TryAcquire(); ///<尝试取得一个信号
virtual bool Acquire(double time=0.0); ///<等待并获取一个信号
};//class Semaphore
}//namespace hgl
#endif//HGL_SEMAPHORE_INCLUDE