Skip to content

Commit 2e0a990

Browse files
committed
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)
2 parents 7fa8d75 + a886dbf commit 2e0a990

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
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 & 3 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,8 +29,6 @@
2829
#include <boost/signals2/signal.hpp>
2930
#include <boost/thread/exceptions.hpp>
3031

31-
#include <signal.h>
32-
3332
static const bool DEFAULT_LOGTIMEMICROS = false;
3433
static const bool DEFAULT_LOGIPS = false;
3534
static const bool DEFAULT_LOGTIMESTAMPS = true;
@@ -52,7 +51,7 @@ extern std::string strMiscWarning;
5251
extern bool fLogTimestamps;
5352
extern bool fLogTimeMicros;
5453
extern bool fLogIPs;
55-
extern volatile sig_atomic_t fReopenDebugLog;
54+
extern std::atomic<bool> fReopenDebugLog;
5655
extern CTranslationInterface translationInterface;
5756

5857
extern const char * const BITCOIN_CONF_FILENAME;

0 commit comments

Comments
 (0)