X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Finit.cpp;h=586e3dab4bba4b62a77b2347bea4ac166a3e8e2e;hp=8d8ce8f4af8e4ce160cab6fbf0800dbaea7453e7;hb=6ec9d30905e8df77e60d0195074920271abb977a;hpb=722ff53718333dc290760d528b7a561d29ab41a8 diff --git a/src/init.cpp b/src/init.cpp index 8d8ce8f..586e3da 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 {