?? event.cpp
字號:
/**
撈亥飄 包訪 扁瓷闌 力傍竅綽 努貳膠甫 瀝狼竊
*/
#include "UtilityCommon.h"
#include "Event.h"
namespace util
{
static HANDLE Create(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR lpName); // 橇肺配 鷗澇 急攫(瀝利 竊薦肺 按眉 急攫絕撈 葷儈 啊瓷竊)
CEvent::CEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState)
{
m_hEvent = Create(lpEventAttributes, bManualReset, bInitialState, NULL);
}
CEvent::CEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, const _tstring& name)
{
m_hEvent = Create(lpEventAttributes, bManualReset, bInitialState, name.c_str());
}
void CEvent::Wait() const
{ // 撈亥飄甫 扁促覆
if(!Wait(INFINITE)) {
}
}
BOOL CEvent::Wait(DWORD timeoutMillis) const
{ // 撈亥飄甫 瘤瀝等 矯埃父怒 扁促覆
BOOL ok;
DWORD result = ::WaitForSingleObject(m_hEvent, timeoutMillis);
if(result == WAIT_TIMEOUT) ok = false;
else if(result == WAIT_OBJECT_0) ok = true;
else {
return false;
}
return ok;
}
void CEvent::Reset(){ // 撈亥飄甫 厚勸己拳 竊
if(!::ResetEvent(m_hEvent)){
return;
};
}
void CEvent::Set()
{ // 撈亥飄甫 勸己拳 竊
if(!::SetEvent(m_hEvent)){
return;
}
}
void CEvent::Pulse()
{
if(!::PulseEvent(m_hEvent)){
return;
};
}
CEvent::~CEvent(void)
{
}
HANDLE CEvent::GetEvent() const
{
return m_hEvent;
}
static HANDLE Create(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR lpName)
{
HANDLE hEvent = ::CreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName);
if(hEvent == NULL){
return NULL;
}
return hEvent;
}
}//End of namespace : util
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -