summaryrefslogtreecommitdiff
path: root/src/mongo/util/concurrency/notification.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util/concurrency/notification.h')
-rw-r--r--src/mongo/util/concurrency/notification.h16
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