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.
//
volatile bool fRequestShutdown = false;
std::atomic<bool> fRequestShutdown(false);
void StartShutdown()
{

View File

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

View File

@ -18,6 +18,7 @@
#include "tinyformat.h"
#include "utiltime.h"
#include <atomic>
#include <exception>
#include <map>
#include <stdint.h>
@ -28,6 +29,10 @@
#include <boost/signals2/signal.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. */
class CTranslationInterface
{
@ -45,7 +50,7 @@ extern bool fServer;
extern std::string strMiscWarning;
extern bool fLogTimestamps;
extern bool fLogIPs;
extern volatile bool fReopenDebugLog;
extern std::atomic<bool> fReopenDebugLog;
extern CTranslationInterface translationInterface;
/**