Browse Source

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
pull/4/head
zkbot 8 years ago
parent
commit
11ce636a9d
  1. 2
      src/init.cpp
  2. 7
      src/util.cpp
  3. 7
      src/util.h

2
src/init.cpp

@ -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()
{

7
src/util.cpp

@ -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 */

7
src/util.h

@ -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;
/**

Loading…
Cancel
Save