Auto merge of #1634 - bitcartel:upstream_8123_race_condition_std_atomic, r=daira

Upstream 8123 race condition

This backports a fix from upstream, with commits applied in sequence:
https://github.com/bitcoin/bitcoin/pull/8004
https://github.com/bitcoin/bitcoin/pull/8112
https://github.com/bitcoin/bitcoin/pull/8123
This commit is contained in:
zkbot 2016-10-25 08:30:59 -04:00
commit 11ce636a9d
3 changed files with 11 additions and 5 deletions

View File

@ -111,7 +111,7 @@ CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
// shutdown thing. // shutdown thing.
// //
volatile bool fRequestShutdown = false; std::atomic<bool> fRequestShutdown(false);
void StartShutdown() void StartShutdown()
{ {

View File

@ -107,9 +107,10 @@ bool fPrintToDebugLog = true;
bool fDaemon = false; bool fDaemon = false;
bool fServer = false; bool fServer = false;
string strMiscWarning; string strMiscWarning;
bool fLogTimestamps = false; bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS;
bool fLogIPs = false; bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS;
volatile bool fReopenDebugLog = false; bool fLogIPs = DEFAULT_LOGIPS;
std::atomic<bool> fReopenDebugLog(false);
CTranslationInterface translationInterface; CTranslationInterface translationInterface;
/** Init OpenSSL library multithreading support */ /** Init OpenSSL library multithreading support */

View File

@ -18,6 +18,7 @@
#include "tinyformat.h" #include "tinyformat.h"
#include "utiltime.h" #include "utiltime.h"
#include <atomic>
#include <exception> #include <exception>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
@ -28,6 +29,10 @@
#include <boost/signals2/signal.hpp> #include <boost/signals2/signal.hpp>
#include <boost/thread/exceptions.hpp> #include <boost/thread/exceptions.hpp>
static const bool DEFAULT_LOGTIMEMICROS = false;
static const bool DEFAULT_LOGIPS = false;
static const bool DEFAULT_LOGTIMESTAMPS = true;
/** Signals for translation. */ /** Signals for translation. */
class CTranslationInterface class CTranslationInterface
{ {
@ -45,7 +50,7 @@ extern bool fServer;
extern std::string strMiscWarning; extern std::string strMiscWarning;
extern bool fLogTimestamps; extern bool fLogTimestamps;
extern bool fLogIPs; extern bool fLogIPs;
extern volatile bool fReopenDebugLog; extern std::atomic<bool> fReopenDebugLog;
extern CTranslationInterface translationInterface; extern CTranslationInterface translationInterface;
/** /**