mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Gavin Andresen: clean shutdown on SIGTERM
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@149 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
14
init.cpp
14
init.cpp
@@ -10,7 +10,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Shutdown
|
||||
@@ -57,6 +56,11 @@ void Shutdown(void* parg)
|
||||
}
|
||||
}
|
||||
|
||||
void HandleSIGTERM(int)
|
||||
{
|
||||
fRequestShutdown = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -130,6 +134,14 @@ bool AppInit2(int argc, char* argv[])
|
||||
#ifndef __WXMSW__
|
||||
umask(077);
|
||||
#endif
|
||||
#ifndef __WXMSW__
|
||||
// Clean shutdown on SIGTERM
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = HandleSIGTERM;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Parameters
|
||||
|
||||
Reference in New Issue
Block a user