void UPnP::StopPortmapping() { if (s_thread.joinable()) s_thread.join(); s_thread = std::thread(&UnmapPortThread); s_thread.join(); }
// Called from GUI thread void Stop() // - Hammertime! { if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) { if (g_EmuThread.joinable()) g_EmuThread.join(); return; } const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; g_bStopping = true; g_video_backend->EmuStateChange(EMUSTATE_CHANGE_STOP); INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----"); // Stop the CPU INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stop CPU").c_str()); PowerPC::Stop(); // Kick it if it's waiting (code stepping wait loop) CCPU::StepOpcode(); if (_CoreParameter.bCPUThread) { // Video_EnterLoop() should now exit so that EmuThread() // will continue concurrently with the rest of the commands // in this function. We no longer rely on Postmessage. INFO_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str()); g_video_backend->Video_ExitLoop(); } INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping Emu thread ...").c_str()); g_EmuThread.join(); // Wait for emuthread to close. INFO_LOG(CONSOLE, "%s", StopMessage(true, "Main Emu thread stopped").c_str()); #ifdef _WIN32 EmuWindow::Close(); #endif // Clear on screen messages that haven't expired g_video_backend->Video_ClearMessages(); // Close the trace file Core::StopTrace(); // Reload sysconf file in order to see changes committed during emulation if (_CoreParameter.bWii) SConfig::GetInstance().m_SYSCONF->Reload(); INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----"); Movie::Shutdown(); g_bStopping = false; }
void join() { c2s_.join(); s2c_.join(); if (ep_) { std::rethrow_exception(ep_); } }
void disconnect() { connected.store(false); closesocket(sock); sender.join(); recver.join(); send_queue.clear(); recv_queue.clear(); }
virtual void TearDown() { // If a thread has not completed, then continuing will cause the tests to // hang forever and could cause issues. If we don't call detach, then // std::terminate is called and all threads are terminated. // Detaching is non-optimal, but should allow the rest of the tests to run // before anything drastic occurs. if (m_done1) m_watcher1.join(); else m_watcher1.detach(); if (m_done2) m_watcher2.join(); else m_watcher2.detach(); }
void StopFakeWork() { t0.join(); t1.join(); t2.join(); t3.join(); t42.join(); t43.join(); t44.join(); t45.join(); tlong.join(); }
void stopSignalHandlers() { #ifdef WIN32 System::sendSignal(::GetCurrentProcessId(), SIGINT); gThreadMessageLoop.join(); #endif }
void Stop_main() { LOG_INFO("Service stop requested, exiting..."); vm.Stop(); main_thread.join(); }
~Task() { if(_thread.joinable()) { _thread.join(); } }
~impl() { stop(); if( th_.joinable() ) { th_.join(); } }
void stop() { assert(_running); _running = false; _thread.join(); }
void StopHTTPServer() { LogPrint(BCLog::HTTP, "Stopping HTTP server\n"); if (workQueue) { LogPrint(BCLog::HTTP, "Waiting for HTTP worker threads to exit\n"); workQueue->WaitExit(); delete workQueue; workQueue = nullptr; } if (eventBase) { LogPrint(BCLog::HTTP, "Waiting for HTTP event thread to exit\n"); // Give event loop a few seconds to exit (to send back last RPC responses), then break it // Before this was solved with event_base_loopexit, but that didn't work as expected in // at least libevent 2.0.21 and always introduced a delay. In libevent // master that appears to be solved, so in the future that solution // could be used again (if desirable). // (see discussion in https://github.com/bitcoin/bitcoin/pull/6990) if (threadResult.valid() && threadResult.wait_for(std::chrono::milliseconds(2000)) == std::future_status::timeout) { LogPrintf("HTTP event loop did not exit within allotted time, sending loopbreak\n"); event_base_loopbreak(eventBase); } threadHTTP.join(); } if (eventHTTP) { evhttp_free(eventHTTP); eventHTTP = 0; } if (eventBase) { event_base_free(eventBase); eventBase = 0; } LogPrint(BCLog::HTTP, "Stopped HTTP server\n"); }
void join_thread(void) { if (super::running.load()) { super::terminate(); callback_thread.join(); } }
int main() { unsigned char a; long long b; unsigned char c; char d[64]; unsigned char e; signal(SIGINT, sigHandler); stop = false; counter = std::thread(thrMain); while (!stop) { //std::cout<<number<<std::endl; //printf("%lld\n", number); a = 0; b = number; for (c = 0; c < 63 && b > 0; c++) { a = b % 10; b /= 10; d[c] = a + 48; } d[c] = '\0'; for (a = --c; c > a / 2; c--) { e = d[c]; d[c] = d[a-c]; d[a-c] = e; } puts(d); } counter.join(); usleep(200); }
//-------------------------------- void StopEngine() { #ifdef USE_THREAD_FOR_INPUT stop = true; t.join(); #endif // USE_THREAD_FOR_INPUT }
void join() { if (!detached) return; #if defined(__APPLE__) || defined(__linux__) /* Release GIL and disassociate from thread state (which was originally associated with the main Python thread) */ py::gil_scoped_release thread_state(true); coro_transfer(&ctx_main, &ctx_thread); coro_stack_free(&stack); /* Destroy the thread state that was created in mainloop() */ { py::gil_scoped_acquire acquire; acquire.dec_ref(); } #endif thread.join(); detached = false; #if defined(__APPLE__) || defined(__linux__) /* Reacquire GIL and reassociate with thread state [via RAII destructor in 'thread_state'] */ #endif }
void WebSocketClientUtil::joinThreads() { if ( _subThread->joinable() ) { _subThread->join(); } }
void WsThreadHelper::joinSubThread() { if (_subThreadInstance->joinable()) { _subThreadInstance->join(); } }
~ScopedThread() { if (t_.joinable()) { t_.join(); } }
void FileServer::stop() { if( _running ) { _endThread = true; _thread.join(); } }
~impl() { _cts.cancel(); if (_jobQueueThread.joinable()) { _jobQueueThread.join(); } _ctx = nullptr; }
void do_final(int code) { aFree(g_PBuff); aFree(PTempBuff); aFree((void*)map_config.mysql_host); aFree((void*)map_config.mysql_database); itemutils::FreeItemList(); battleutils::FreeWeaponSkillsList(); battleutils::FreeSkillChainDamageModifiers(); petutils::FreePetList(); zoneutils::FreeZoneList(); luautils::free(); message::close(); if (messageThread.joinable()) { messageThread.join(); } delete CTaskMgr::getInstance(); delete CVanaTime::getInstance(); Sql_Free(SqlHandle); timer_final(); socket_final(); malloc_final(); exit(code); }
void PS3EyeStereoDepthApp::shutdown() { stopThreads = TRUE; if (calibrationThread.joinable()) { calibrationThread.join(); } camPair.stop(); }
~WSClientImpl() override { ws_.close({}); stream_.close(); work_ = boost::none; thread_.join(); }
~http_sync_server() { error_code ec; ios_.dispatch( [&]{ acceptor_.close(ec); }); thread_.join(); }
void peterDeJongTeardown( ) { shouldRun = false; if( updater.joinable( ) ) updater.join( ); }
void stopConsumerThread(){ done=true; //wakup if sleeping cond_var.Signal(); //wait for termination consumerThread.join(); }
inline engine_t::~engine_t() { signal([&] { running_ = false; }); handle_.join(); }
void ThreadManager::join(std::thread& thread) { if(thread.joinable()) { thread.join(); unregisterThread(); } }
~async_message_loop() { if(thread.get_id() != std::thread::id()){ DWORD id = ::GetThreadId(thread.native_handle()); ::PostThreadMessageW(id, WM_QUIT, 0, 0); thread.join(); } }