mirror of https://github.com/facebook/rocksdb.git
make MockTimeEnv::current_time_ atomic to fix data race
Summary: fix a new TSAN failure https://gist.github.com/miasantreble/7599c33f4e17da1024c67d4540dbe397 Closes https://github.com/facebook/rocksdb/pull/3694 Differential Revision: D7565310 Pulled By: miasantreble fbshipit-source-id: f672c96e925797b34dec6e20b59527e8eebaa825
This commit is contained in:
parent
5ec382b918
commit
2770a94c42
|
@ -606,7 +606,7 @@ class MockTimeEnv : public EnvWrapper {
|
|||
}
|
||||
|
||||
private:
|
||||
uint64_t current_time_ = 0;
|
||||
std::atomic<uint64_t> current_time_{0};
|
||||
};
|
||||
|
||||
#ifndef ROCKSDB_LITE
|
||||
|
|
|
@ -15,10 +15,11 @@
|
|||
namespace rocksdb {
|
||||
|
||||
const char* Status::CopyState(const char* state) {
|
||||
const size_t cch =
|
||||
const size_t cch =
|
||||
std::strlen(state) + 1; // +1 for the null terminator
|
||||
char* const result =
|
||||
new char[cch];
|
||||
new char[cch];
|
||||
result[cch - 1] = '\0';
|
||||
#ifdef OS_WIN
|
||||
errno_t ret;
|
||||
ret = strncpy_s(result, cch, state, cch - 1);
|
||||
|
|
Loading…
Reference in New Issue