aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-06-14 18:13:46 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2012-06-14 18:13:46 +0000
commit6ec9d30905e8df77e60d0195074920271abb977a (patch)
tree59b21a9be7282b5ee3a2dc6c0b4f2d5a31882904 /src/init.cpp
parent722ff53718333dc290760d528b7a561d29ab41a8 (diff)
parent3703150d56ff6ee557ab330e55637c9c23835902 (diff)
downloadbitcoin-6ec9d30905e8df77e60d0195074920271abb977a.tar.xz
Merge branch '0.5.x' into 0.6.0.x
Conflicts: src/main.h src/net.cpp src/serialize.h
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 8d8ce8f4af..586e3dab4b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -42,6 +42,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)
+ 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;
@@ -67,7 +78,10 @@ void Shutdown(void* parg)
Sleep(50);
printf("Bitcoin exiting\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
{