RHoldemModule::RHoldemModule(LPCTSTR name, UINT shutdown_thread_message): named_object_(kRamblerGlobalPrefixMutex, name), shutdown_thread_message_(shutdown_thread_message){ auto_shutdown_.reset(new ObjectShutdownManager(name)); connect(auto_shutdown_.get(), SIGNAL(shutdownRequested()), SIGNAL(shutdownRequested())); Init(); }
bool WorkerThread::OneEyeSleepMs(int time, int checkPeriod) { for(int timeToSleep = std::min(time, checkPeriod); timeToSleep > 0; timeToSleep = std::min(time, checkPeriod)) { if(shutdownRequested()) return true; std::this_thread::sleep_for(std::chrono::milliseconds(timeToSleep)); time -= timeToSleep; } return false; }