void HandlerCloseEvent(int nSignalNum) { CGameService::GetInstancePtr()->StopService(); ComEvent.SetEvent(); return ; }
BOOL WINAPI HandlerCloseEvent(DWORD dwCtrlType) { if(dwCtrlType == CTRL_CLOSE_EVENT) { ComEvent.SetEvent(); } return FALSE; }
BOOL CGameService::Run() { ComEvent.InitEvent(FALSE, FALSE); #ifdef WIN32 SetConsoleCtrlHandler(HandlerCloseEvent, TRUE); #else if(SIG_ERR == signal(SIGINT, &HandlerCloseEvent)) { CLog::GetInstancePtr()->AddLog("注册CTRL+C事件失败!"); } #endif ComEvent.Wait(); return TRUE; }
BOOL WINAPI HandlerCloseEvent(DWORD dwCtrlType) { if(dwCtrlType == CTRL_CLOSE_EVENT) { CGameService::GetInstancePtr()->StopService(); ComEvent.SetEvent(); } return FALSE; }