aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2012-06-13 23:12:22 -0700
committerWladimir J. van der Laan <[email protected]>2012-06-13 23:12:22 -0700
commit0f10b21719e1b0d9683a142f0a7105e65f095694 (patch)
treee30dcb8b0da343c8ba9ddaca27b7c2c78b7d865a /src/init.cpp
parentMerge pull request #1420 from Diapolo/extend_showNormalIfMinimized (diff)
parentintroduce a new StartShutdown() function, which starts a thread with Shutdown... (diff)
downloaddiscoin-0f10b21719e1b0d9683a142f0a7105e65f095694.tar.xz
discoin-0f10b21719e1b0d9683a142f0a7105e65f095694.zip
Merge pull request #1439 from Diapolo/ClientShutdown
re-work Shutdown() function
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index bf9551e85..08b594f56 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -38,6 +38,17 @@ void ExitTimeout(void* parg)
#endif
}
+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)
{
static CCriticalSection cs_Shutdown;
@@ -66,7 +77,10 @@ void Shutdown(void* parg)
Sleep(50);
printf("Bitcoin exited\n\n");
fExit = true;
+#ifndef QT_GUI
+ // ensure non UI client get's exited here, but let Bitcoin-Qt reach return 0; in bitcoin.cpp
exit(0);
+#endif
}
else
{