From c8c2fbe07f1a5475aea3a2680af9130558c7e5c8 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Wed, 6 Mar 2013 22:16:05 -0500 Subject: Shutdown cleanup prep-work Create a boost::thread_group object at the qt/bitcoind main-loop level that will hold pointers to all the main-loop threads. This will replace the vnThreadsRunning[] array. For testing, ported the BitcoinMiner threads to use its own boost::thread_group. --- src/qt/bitcoin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/qt/bitcoin.cpp') diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 2c47f30e9..a805e350e 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -11,6 +11,7 @@ #include "guiutil.h" #include "guiconstants.h" #include "init.h" +#include "util.h" #include "ui_interface.h" #include "paymentserver.h" @@ -215,9 +216,10 @@ int main(int argc, char *argv[]) if (GUIUtil::GetStartOnSystemStartup()) GUIUtil::SetStartOnSystemStartup(true); + boost::thread_group threadGroup; BitcoinGUI window; guiref = &window; - if(AppInit2()) + if(AppInit2(threadGroup)) { { // Put this in a block, so that the Model objects are cleaned up before @@ -259,6 +261,8 @@ int main(int argc, char *argv[]) } // Shutdown the core and its threads, but don't exit Bitcoin-Qt here Shutdown(NULL); + threadGroup.interrupt_all(); + threadGroup.join_all(); } else { -- cgit v1.2.3