Skip to content

Commit bf069fb

Browse files
sipacodablock
authored andcommitted
Merge bitcoin#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)
1 parent 09eda97 commit bf069fb

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
@@ -158,7 +158,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
158158
// shutdown thing.
159159
//
160160

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

163163
void StartShutdown()
164164
{

src/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS;
131131
bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS;
132132
bool fLogThreadNames = DEFAULT_LOGTHREADNAMES;
133133
bool fLogIPs = DEFAULT_LOGIPS;
134-
volatile sig_atomic_t fReopenDebugLog = false;
134+
std::atomic<bool> fReopenDebugLog(false);
135135
CTranslationInterface translationInterface;
136136

137137
/** Init OpenSSL library multithreading support */

src/util.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "utiltime.h"
2121
#include "amount.h"
2222

23+
#include <atomic>
2324
#include <exception>
2425
#include <map>
2526
#include <stdint.h>
@@ -30,8 +31,6 @@
3031
#include <boost/signals2/signal.hpp>
3132
#include <boost/thread/exceptions.hpp>
3233

33-
#include <signal.h>
34-
3534
// Debugging macros
3635

3736
// Uncomment the following line to enable debugging messages
@@ -73,7 +72,7 @@ extern bool fLogTimestamps;
7372
extern bool fLogTimeMicros;
7473
extern bool fLogThreadNames;
7574
extern bool fLogIPs;
76-
extern volatile sig_atomic_t fReopenDebugLog;
75+
extern std::atomic<bool> fReopenDebugLog;
7776
extern CTranslationInterface translationInterface;
7877

7978
extern const char * const BITCOIN_CONF_FILENAME;

0 commit comments

Comments
 (0)