From fad48f416ca24f924bc81e4b5fc43bfe76d95508 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 30 May 2016 15:39:37 +0200 Subject: [PATCH] Use std::atomic for fRequestShutdown and fReopenDebugLog --- src/init.cpp | 2 +- src/util.cpp | 2 +- src/util.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index d2176be92..518aaf46f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -124,7 +124,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat"; // shutdown thing. // -volatile bool fRequestShutdown = false; +std::atomic fRequestShutdown(false); void StartShutdown() { diff --git a/src/util.cpp b/src/util.cpp index bbaacef3e..a001de400 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -112,7 +112,7 @@ string strMiscWarning; bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS; bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS; bool fLogIPs = DEFAULT_LOGIPS; -volatile bool fReopenDebugLog = false; +std::atomic fReopenDebugLog(false); CTranslationInterface translationInterface; /** Init OpenSSL library multithreading support */ diff --git a/src/util.h b/src/util.h index 2c5e93bcc..440cb54da 100644 --- a/src/util.h +++ b/src/util.h @@ -18,6 +18,7 @@ #include "tinyformat.h" #include "utiltime.h" +#include #include #include #include @@ -59,7 +60,7 @@ extern std::string strMiscWarning; extern bool fLogTimestamps; extern bool fLogTimeMicros; extern bool fLogIPs; -extern volatile bool fReopenDebugLog; +extern std::atomic fReopenDebugLog; extern CTranslationInterface translationInterface; extern const char * const BITCOIN_CONF_FILENAME;