Make PosixLogger::flush_pending_ atomic

Summary:
TSAN sometimes complaints data race of PosixLogger::flush_pending_. Make it atomic.
Closes https://github.com/facebook/rocksdb/pull/2231

Differential Revision: D4973397

Pulled By: siying

fbshipit-source-id: 571e886e3eca3231705919d573e250c1c1ec3764
This commit is contained in:
Siying Dong 2017-04-28 17:00:24 -07:00 committed by Facebook Github Bot
parent da4b2070b3
commit a2b05210ef
1 changed files with 1 additions and 1 deletions

2
env/posix_logger.h vendored
View File

@ -41,7 +41,7 @@ class PosixLogger : public Logger {
const static uint64_t flush_every_seconds_ = 5; const static uint64_t flush_every_seconds_ = 5;
std::atomic_uint_fast64_t last_flush_micros_; std::atomic_uint_fast64_t last_flush_micros_;
Env* env_; Env* env_;
bool flush_pending_; std::atomic<bool> flush_pending_;
public: public:
PosixLogger(FILE* f, uint64_t (*gettid)(), Env* env, PosixLogger(FILE* f, uint64_t (*gettid)(), Env* env,
const InfoLogLevel log_level = InfoLogLevel::ERROR_LEVEL) const InfoLogLevel log_level = InfoLogLevel::ERROR_LEVEL)