Пример #1
0
std::tuple<bool, boost::thread*> RunSharkfund(int argc, char* argv[])
{
	boost::thread* detectShutdownThread = NULL;
	static boost::thread_group threadGroup;
	SetupEnvironment();

	bool fRet = false;

	// Connect Dacrsd signal handlers
	noui_connect();

	fRet = AppInit(argc, argv,threadGroup);

	detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));

	if (!fRet) {
		if (detectShutdownThread)
			detectShutdownThread->interrupt();

		threadGroup.interrupt_all();

		// threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of
		// the startup-failure cases to make sure they don't result in a hang due to some
		// thread-blocking-waiting-for-another-thread-during-startup case
	}
  return std::make_tuple (fRet,detectShutdownThread);
}
Пример #2
0
    ~TestingSetup()
    {
        threadGroup.interrupt_all();
        threadGroup.join_all();
        Bitcredit_UnregisterNodeSignals(Credits_NetParams()->GetNodeSignals());
#ifdef ENABLE_WALLET
        delete bitcoin_pwalletMain;
        bitcoin_pwalletMain = NULL;
        delete bitcredit_pwalletMain;
        bitcredit_pwalletMain = NULL;
        delete deposit_pwalletMain;
        deposit_pwalletMain = NULL;
#endif
        delete credits_pcoinsTip;
        delete bitcredit_pcoinsdbview;
        delete bitcredit_pblocktree;

        delete bitcoin_pcoinsTip;
        delete bitcoin_pcoinsdbview;
        delete bitcoin_pblocktree;
#ifdef ENABLE_WALLET
        bitcoin_bitdb.Flush(true);
        bitcredit_bitdb.Flush(true);
        deposit_bitdb.Flush(true);
#endif
        boost::filesystem::remove_all(pathTemp);
    }
Пример #3
0
void stop(int sig)
{
	if (!die) {
		die = true;
		comm->stop();
		monitorThreads.interrupt_all();
	}
}
Пример #4
0
 virtual ~Log()
 {
     _isStopping = true;
     _threadPool.interrupt_all();
     _threadPool.join_all();
     _stringLoggerThread.interrupt();
     _stringLoggerThread.join();
 }
Пример #5
0
 ~TestingSetup()
 {
     threadGroup.interrupt_all();
     threadGroup.join_all();
     delete pwalletMain;
     pwalletMain = NULL;
     delete pcoinsTip;
     delete pcoinsdbview;
     delete pblocktree;
     bitdb.Flush(true);
     boost::filesystem::remove_all(pathTemp);
 }
void cia_client::stop()
{
	if (!m_started_) return;
	m_started_ = false;
	m_sock_.close();
	m_deal_ch_msg_group.interrupt_all();

	ptr self = shared_from_this();
	auto it = std::find(clients.begin(), clients.end(), self);
	clients.erase(it);
	BOOST_LOG_SEV(cia_g_logger, Debug) << "客户端socket已经调用stop函数关闭";
	//x m_config_server->set_started(true);	// 为了防止网络情况异常, 造成服务端关闭连接后重置此值为2, 通讯端保证此值为1
}
Пример #7
0
    ~TestingSetup()
    {
        threadGroup.interrupt_all();
        threadGroup.join_all();
        UnregisterNodeSignals(GetNodeSignals());
#ifdef ENABLE_WALLET
        delete pwalletMain;
        pwalletMain = NULL;
#endif
        delete pblocktree;
	delete pviewTip;
#ifdef ENABLE_WALLET
        bitdb.Flush(true);
#endif
        boost::filesystem::remove_all(pathTemp);
    }
Пример #8
0
std::tuple<bool, boost::thread*> RunDacrs(int argc, char* argv[]) {
	boost::thread* detectShutdownThread = NULL;
	static boost::thread_group threadGroup;
	SetupEnvironment();

	bool fRet = false;

	// Connect Dacrsd signal handlers
	noui_connect();

	fRet = AppInit(argc, argv, threadGroup);

	detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));

	if (!fRet) {
		if (detectShutdownThread)
			detectShutdownThread->interrupt();

		threadGroup.interrupt_all();
	}
	return std::make_tuple(fRet, detectShutdownThread);
}
Пример #9
0
void waitTermination( boost::thread_group& threads, std::initializer_list< int > signals = { SIGINT, SIGTERM, SIGQUIT } )
{
     sigset_t sset;

     sigemptyset( &sset );

     for( const auto each: signals )
     {
          sigaddset( &sset, each );
     }

     sigprocmask( SIG_BLOCK, &sset, nullptr );

     std::cout << "threads running: " << threads.size() << "; main thread waiting for termination signals...\n";

     int sig = 0;
     sigwait( &sset, &sig );

     std::cout << "termination signal " << sig << " has been caught\n" << "interrupting threads...\n";

     threads.interrupt_all();
}
 ~Threadpool() {
     Logger::pLOG->info("Delete threadpool of DOR");
     _tg.interrupt_all();
     _tg.join_all();
 }
Пример #11
0
void M6Processor::Error(exception_ptr e)
{
    mException = e;
    mFileThreads.interrupt_all();
    mDocThreads.interrupt_all();
}