From bf069fb1bd4857094ef0d88ae6a80fc6f76fe235 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 1 Jun 2016 20:23:11 +0200 Subject: [PATCH] Merge #8123: Use std::atomic for fRequestShutdown and fReopenDebugLog a886dbf Use std::atomic for fRequestShutdown and fReopenDebugLog (Pieter Wuille) 16cf85f Revert "Include signal.h for sig_atomic_t in WIN32" (Pieter Wuille) --- src/init.cpp | 2 +- src/util.cpp | 2 +- src/util.h | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 8d242a1d5a..b4f61efaaf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -158,7 +158,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat"; // shutdown thing. // -volatile sig_atomic_t fRequestShutdown = false; +std::atomic fRequestShutdown(false); void StartShutdown() { diff --git a/src/util.cpp b/src/util.cpp index d25f3b8664..f41fefa638 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -131,7 +131,7 @@ bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS; bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS; bool fLogThreadNames = DEFAULT_LOGTHREADNAMES; bool fLogIPs = DEFAULT_LOGIPS; -volatile sig_atomic_t fReopenDebugLog = false; +std::atomic fReopenDebugLog(false); CTranslationInterface translationInterface; /** Init OpenSSL library multithreading support */ diff --git a/src/util.h b/src/util.h index a04d1b709a..70f4748e96 100644 --- a/src/util.h +++ b/src/util.h @@ -20,6 +20,7 @@ #include "utiltime.h" #include "amount.h" +#include #include #include #include @@ -30,8 +31,6 @@ #include #include -#include - // Debugging macros // Uncomment the following line to enable debugging messages @@ -73,7 +72,7 @@ extern bool fLogTimestamps; extern bool fLogTimeMicros; extern bool fLogThreadNames; extern bool fLogIPs; -extern volatile sig_atomic_t fReopenDebugLog; +extern std::atomic fReopenDebugLog; extern CTranslationInterface translationInterface; extern const char * const BITCOIN_CONF_FILENAME;