diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2021-10-14 15:32:09 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-14 16:48:32 +0000 |
commit | cd1c6e9037e19b6971c53349daef5b556fdfb310 (patch) | |
tree | a5c2564a5d4a09c8180ae645a5d165b69a650896 /src/mongo/util/progress_meter.h | |
parent | 05c9174694e84c443b4a58050c64f113eebc42bf (diff) | |
download | mongo-cd1c6e9037e19b6971c53349daef5b556fdfb310.tar.gz |
SERVER-60646 remove ThreadSafeString
Diffstat (limited to 'src/mongo/util/progress_meter.h')
-rw-r--r-- | src/mongo/util/progress_meter.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/mongo/util/progress_meter.h b/src/mongo/util/progress_meter.h index 35b3305f94a..1e2e511da72 100644 --- a/src/mongo/util/progress_meter.h +++ b/src/mongo/util/progress_meter.h @@ -29,9 +29,11 @@ #pragma once -#include "mongo/util/thread_safe_string.h" - #include <string> +#include <utility> + +#include "mongo/base/string_data.h" +#include "mongo/stdx/mutex.h" namespace mongo { @@ -45,8 +47,7 @@ public: int checkInterval = 100, std::string units = "", std::string name = "Progress") - : _showTotal(true), _units(units) { - _name = name.c_str(); + : _showTotal(true), _units(units), _name(std::move(name)) { reset(total, secondsBetween, checkInterval); } @@ -78,10 +79,12 @@ public: } void setName(StringData name) { - _name = name; + stdx::lock_guard lk(_nameMutex); + _name = std::string{name}; } std::string getName() const { - return _name.toString(); + stdx::lock_guard lk(_nameMutex); + return _name; } void setTotalWhileRunning(unsigned long long total) { @@ -123,7 +126,9 @@ private: int _lastTime; std::string _units; - ThreadSafeString _name; + + mutable stdx::mutex _nameMutex; // NOLINT + std::string _name; // guarded by _nameMutex }; /* |