summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/oplog_buffer_blocking_queue.cpp')
-rw-r--r--src/mongo/db/repl/oplog_buffer_blocking_queue.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp b/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
index 86b7f906d1a..d81cc6adc9c 100644
--- a/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
+++ b/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
@@ -112,11 +112,20 @@ bool OplogBufferBlockingQueue::tryPop(OperationContext*, Value* value) {
return true;
}
-bool OplogBufferBlockingQueue::waitForData(Seconds waitDuration) {
+bool OplogBufferBlockingQueue::waitForDataFor(Milliseconds waitDuration,
+ Interruptible* interruptible) {
Value ignored;
stdx::unique_lock<Latch> lk(_notEmptyMutex);
- _notEmptyCv.wait_for(
- lk, waitDuration.toSystemDuration(), [&] { return _drainMode || _queue.peek(ignored); });
+ interruptible->waitForConditionOrInterruptFor(
+ _notEmptyCv, lk, waitDuration, [&] { return _drainMode || _queue.peek(ignored); });
+ return _queue.peek(ignored);
+}
+
+bool OplogBufferBlockingQueue::waitForDataUntil(Date_t deadline, Interruptible* interruptible) {
+ Value ignored;
+ stdx::unique_lock<Latch> lk(_notEmptyMutex);
+ interruptible->waitForConditionOrInterruptUntil(
+ _notEmptyCv, lk, deadline, [&] { return _drainMode || _queue.peek(ignored); });
return _queue.peek(ignored);
}