diff options
author | Ben Caimano <ben.caimano@mongodb.com> | 2019-09-17 23:22:19 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-17 23:22:19 +0000 |
commit | bc11369435ca51e2ff6897433d00f6b909f6a25f (patch) | |
tree | 251653ec8285d798b41846e343e7e414e80ff277 /src/mongo/util/concurrency/notification.h | |
parent | 45aea2495306dd61fab46bd398735bb6aaf7b53a (diff) | |
download | mongo-bc11369435ca51e2ff6897433d00f6b909f6a25f.tar.gz |
SERVER-42165 Replace uses of stdx::mutex with mongo::Mutex
Diffstat (limited to 'src/mongo/util/concurrency/notification.h')
-rw-r--r-- | src/mongo/util/concurrency/notification.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/util/concurrency/notification.h b/src/mongo/util/concurrency/notification.h index 44bc7efc9ac..50e6b5e2302 100644 --- a/src/mongo/util/concurrency/notification.h +++ b/src/mongo/util/concurrency/notification.h @@ -32,8 +32,8 @@ #include <boost/optional.hpp> #include "mongo/db/operation_context.h" -#include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/mutex.h" +#include "mongo/platform/condition_variable.h" +#include "mongo/platform/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" #include "mongo/util/time_support.h" @@ -59,7 +59,7 @@ public: * block). */ explicit operator bool() const { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); return !!_value; } @@ -68,7 +68,7 @@ public: * If the wait is interrupted, throws an exception. */ T& get(OperationContext* opCtx) { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); opCtx->waitForConditionOrInterrupt(_condVar, lock, [this]() -> bool { return !!_value; }); return _value.get(); } @@ -78,7 +78,7 @@ public: * This variant of get cannot be interrupted. */ T& get() { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); while (!_value) { _condVar.wait(lock); } @@ -91,7 +91,7 @@ public: * call. Must only be called once for the lifetime of the notification. */ void set(T value) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); invariant(!_value); _value = std::move(value); _condVar.notify_all(); @@ -104,13 +104,13 @@ public: * If the wait is interrupted, throws an exception. */ bool waitFor(OperationContext* opCtx, Milliseconds waitTimeout) { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); return opCtx->waitForConditionOrInterruptFor( _condVar, lock, waitTimeout, [&]() { return !!_value; }); } private: - mutable stdx::mutex _mutex; + mutable Mutex _mutex = MONGO_MAKE_LATCH("Notification::_mutex"); stdx::condition_variable _condVar; // Protected by mutex and only moves from not-set to set once |