ThreadPool::~ThreadPool() { requestTermination(); waitFor(seconds(10)); for (Thread *thread : _threads) { delete thread; } }
ServerThreadManager::~ServerThreadManager() { requestTermination(); while (!m_threads.isEmpty()) m_threads.first()->wait(); m_threadData.setLocalData(0); }
bool GamePlayState::keyReleased(const SDL_KeyboardEvent &e) { if(e.keysym.sym == SDLK_w) { mForward = false; return true; } else if(e.keysym.sym == SDLK_s) { mBackward = false; return true; } else if(e.keysym.sym == SDLK_a) { mLeft = false; return true; } else if(e.keysym.sym == SDLK_d) { mRight = false; return true; } else if(e.keysym.sym == SDLK_ESCAPE) { requestTermination(); return true; } else if (e.keysym.sym == SDLK_i) { mShadows = !mShadows; if (mShadows) mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE); else mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); } return true; }
DatabaseThread::~DatabaseThread() { bool terminationRequested; { MutexLocker lock(m_terminationRequestedMutex); terminationRequested = m_terminationRequested; } if (!terminationRequested) requestTermination(0); m_thread.clear(); }
void MocketConnector::terminateExecution (void) { requestTermination(); if (Mutex::RC_Ok == _mConnector.lock()) { if (_pServerMocket) { _pServerMocket->close(); } Connector::terminateExecution(); _mConnector.unlock(); } }
void SocketConnector::terminateExecution (void) { requestTermination(); if (Mutex::RC_Ok == _mConnector.lock()) { if (_pServerSocket) { _pServerSocket->shutdown (true, false); _pServerSocket->disableReceive(); } Connector::terminateExecution(); _mConnector.unlock(); } }
MocketConnector::~MocketConnector (void) { requestTermination(); if (Mutex::RC_Ok == _mConnector.lock()) { if (_pServerMocket) { _pServerMocket->close(); delete _pServerMocket; _pServerMocket = NULL; } _mConnector.unlock(); } }
SocketConnector::~SocketConnector (void) { requestTermination(); if (Mutex::RC_Ok == _mConnector.lock()) { if (_pServerSocket) { _pServerSocket->shutdown (true, false); _pServerSocket->disableReceive(); delete _pServerSocket; _pServerSocket = NULL; } _mConnector.unlock(); } }
TapInterface::~TapInterface (void) { requestTermination(); #if defined (WIN32) CloseHandle (_hInterface); _hInterface = nullptr; CloseHandle (_oRead.hEvent); _oRead.hEvent = nullptr; CloseHandle (_oWrite.hEvent); _oWrite.hEvent = nullptr; #elif defined (LINUX) close (_fdTAP); _fdTAP = -1; #endif }
VOID WINAPI ServiceController(DWORD ctrlCode) { switch (ctrlCode) { case SERVICE_CONTROL_STOP: if (g_ServiceStatus.dwCurrentState != SERVICE_RUNNING) break; g_ServiceStatus.dwControlsAccepted = 0; g_ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; g_ServiceStatus.dwWin32ExitCode = 0; g_ServiceStatus.dwCheckPoint = 0; SetServiceStatus(g_StatusHandle, &g_ServiceStatus); // Call termination function in server.cpp requestTermination(); break; default: break; } }