diff options
author | Giel van Schijndel <me@mortis.eu> | 2012-06-17 16:21:09 +0200 |
---|---|---|
committer | Giel van Schijndel <me@mortis.eu> | 2012-06-17 21:50:49 +0200 |
commit | 896899e0d66e25f6549a92749d237c8a87b12f08 (patch) | |
tree | 20072e7f47ae272f519e82d195a33462b8edf9bf /src/init.cpp | |
parent | 07368a9e3c60bbef8452501d34bb8d3688cbca13 (diff) |
*Always* send a shutdown signal to enable custom shutdown actions
NOTE: This is required to be sure that we can properly shut down the RPC
thread.
Signed-off-by: Giel van Schijndel <me@mortis.eu>
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/init.cpp b/src/init.cpp index 08b594f56c..4e0947a16a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -9,6 +9,7 @@ #include "init.h" #include "util.h" #include "ui_interface.h" +#include <boost/bind.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/filesystem/convenience.hpp> @@ -40,13 +41,8 @@ void ExitTimeout(void* parg) void StartShutdown() { -#ifdef QT_GUI // ensure we leave the Qt main loop for a clean GUI exit (Shutdown() is called in bitcoin.cpp afterwards) uiInterface.QueueShutdown(); -#else - // Without UI, Shutdown() can simply be started in a new thread - CreateThread(Shutdown, NULL); -#endif } void Shutdown(void* parg) @@ -154,6 +150,11 @@ bool AppInit(int argc, char* argv[]) exit(ret); } + // Create the shutdown thread when receiving a shutdown signal + boost::signals2::scoped_connection do_stop( + uiInterface.QueueShutdown.connect(boost::bind( + &CreateThread, &Shutdown, static_cast<void*>(0), false))); + fRet = AppInit2(); } catch (std::exception& e) { |