Skip to content

Commit a886dbf

Browse files
committed
Use std::atomic for fRequestShutdown and fReopenDebugLog
1 parent 16cf85f commit a886dbf

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
123123
// shutdown thing.
124124
//
125125

126-
volatile sig_atomic_t fRequestShutdown = false;
126+
std::atomic<bool> fRequestShutdown(false);
127127

128128
void StartShutdown()
129129
{

src/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ string strMiscWarning;
113113
bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS;
114114
bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS;
115115
bool fLogIPs = DEFAULT_LOGIPS;
116-
volatile sig_atomic_t fReopenDebugLog = false;
116+
std::atomic<bool> fReopenDebugLog(false);
117117
CTranslationInterface translationInterface;
118118

119119
/** Init OpenSSL library multithreading support */

src/util.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "tinyformat.h"
1919
#include "utiltime.h"
2020

21+
#include <atomic>
2122
#include <exception>
2223
#include <map>
2324
#include <stdint.h>
@@ -28,10 +29,6 @@
2829
#include <boost/signals2/signal.hpp>
2930
#include <boost/thread/exceptions.hpp>
3031

31-
#ifndef WIN32
32-
#include <signal.h>
33-
#endif
34-
3532
static const bool DEFAULT_LOGTIMEMICROS = false;
3633
static const bool DEFAULT_LOGIPS = false;
3734
static const bool DEFAULT_LOGTIMESTAMPS = true;
@@ -54,7 +51,7 @@ extern std::string strMiscWarning;
5451
extern bool fLogTimestamps;
5552
extern bool fLogTimeMicros;
5653
extern bool fLogIPs;
57-
extern volatile sig_atomic_t fReopenDebugLog;
54+
extern std::atomic<bool> fReopenDebugLog;
5855
extern CTranslationInterface translationInterface;
5956

6057
extern const char * const BITCOIN_CONF_FILENAME;

0 commit comments

Comments
 (0)