diff options
Diffstat (limited to 'src/mongo/db/repl/oplog_buffer_proxy.cpp')
-rw-r--r-- | src/mongo/db/repl/oplog_buffer_proxy.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mongo/db/repl/oplog_buffer_proxy.cpp b/src/mongo/db/repl/oplog_buffer_proxy.cpp index 45b6803abcf..3e2705511bb 100644 --- a/src/mongo/db/repl/oplog_buffer_proxy.cpp +++ b/src/mongo/db/repl/oplog_buffer_proxy.cpp @@ -51,8 +51,8 @@ void OplogBufferProxy::startup(OperationContext* opCtx) { void OplogBufferProxy::shutdown(OperationContext* opCtx) { { - stdx::lock_guard<stdx::mutex> backLock(_lastPushedMutex); - stdx::lock_guard<stdx::mutex> frontLock(_lastPeekedMutex); + stdx::lock_guard<Latch> backLock(_lastPushedMutex); + stdx::lock_guard<Latch> frontLock(_lastPeekedMutex); _lastPushed.reset(); _lastPeeked.reset(); } @@ -65,7 +65,7 @@ void OplogBufferProxy::push(OperationContext* opCtx, if (begin == end) { return; } - stdx::lock_guard<stdx::mutex> lk(_lastPushedMutex); + stdx::lock_guard<Latch> lk(_lastPushedMutex); _lastPushed = *(end - 1); _target->push(opCtx, begin, end); } @@ -91,16 +91,16 @@ std::size_t OplogBufferProxy::getCount() const { } void OplogBufferProxy::clear(OperationContext* opCtx) { - stdx::lock_guard<stdx::mutex> backLock(_lastPushedMutex); - stdx::lock_guard<stdx::mutex> frontLock(_lastPeekedMutex); + stdx::lock_guard<Latch> backLock(_lastPushedMutex); + stdx::lock_guard<Latch> frontLock(_lastPeekedMutex); _lastPushed.reset(); _lastPeeked.reset(); _target->clear(opCtx); } bool OplogBufferProxy::tryPop(OperationContext* opCtx, Value* value) { - stdx::lock_guard<stdx::mutex> backLock(_lastPushedMutex); - stdx::lock_guard<stdx::mutex> frontLock(_lastPeekedMutex); + stdx::lock_guard<Latch> backLock(_lastPushedMutex); + stdx::lock_guard<Latch> frontLock(_lastPeekedMutex); if (!_target->tryPop(opCtx, value)) { return false; } @@ -114,7 +114,7 @@ bool OplogBufferProxy::tryPop(OperationContext* opCtx, Value* value) { bool OplogBufferProxy::waitForData(Seconds waitDuration) { { - stdx::unique_lock<stdx::mutex> lk(_lastPushedMutex); + stdx::unique_lock<Latch> lk(_lastPushedMutex); if (_lastPushed) { return true; } @@ -123,7 +123,7 @@ bool OplogBufferProxy::waitForData(Seconds waitDuration) { } bool OplogBufferProxy::peek(OperationContext* opCtx, Value* value) { - stdx::lock_guard<stdx::mutex> lk(_lastPeekedMutex); + stdx::lock_guard<Latch> lk(_lastPeekedMutex); if (_lastPeeked) { *value = *_lastPeeked; return true; @@ -137,7 +137,7 @@ bool OplogBufferProxy::peek(OperationContext* opCtx, Value* value) { boost::optional<OplogBuffer::Value> OplogBufferProxy::lastObjectPushed( OperationContext* opCtx) const { - stdx::lock_guard<stdx::mutex> lk(_lastPushedMutex); + stdx::lock_guard<Latch> lk(_lastPushedMutex); if (!_lastPushed) { return boost::none; } @@ -145,7 +145,7 @@ boost::optional<OplogBuffer::Value> OplogBufferProxy::lastObjectPushed( } boost::optional<OplogBuffer::Value> OplogBufferProxy::getLastPeeked_forTest() const { - stdx::lock_guard<stdx::mutex> lk(_lastPeekedMutex); + stdx::lock_guard<Latch> lk(_lastPeekedMutex); return _lastPeeked; } |