diff options
author | Spencer Jackson <spencer.jackson@mongodb.com> | 2017-12-14 14:32:18 -0500 |
---|---|---|
committer | Spencer Jackson <spencer.jackson@mongodb.com> | 2017-12-14 14:32:18 -0500 |
commit | 1f38fb202b9f8696cf28d39e674242e036c0b75c (patch) | |
tree | 249a9c923a97dd7e37d8898c3782bd27a6dd53a3 /src/mongo/db/catalog/collection.cpp | |
parent | 47247293f18ea581954f6fcf4c0018b7828e3c3a (diff) | |
download | mongo-1f38fb202b9f8696cf28d39e674242e036c0b75c.tar.gz |
Revert "SERVER-31684 Fix unexpected "operation exceeded time limit" errors"
This reverts commit b79e5f04ffc79b5892f89c22b9e5f26a297b1185.
Diffstat (limited to 'src/mongo/db/catalog/collection.cpp')
-rw-r--r-- | src/mongo/db/catalog/collection.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp index 6493d147605..5d8e64a9bdd 100644 --- a/src/mongo/db/catalog/collection.cpp +++ b/src/mongo/db/catalog/collection.cpp @@ -152,15 +152,33 @@ void CappedInsertNotifier::notifyAll() { _notifier.notify_all(); } -void CappedInsertNotifier::waitUntil(uint64_t prevVersion, Date_t deadline) const { - stdx::unique_lock<stdx::mutex> lk(_mutex); +void CappedInsertNotifier::_wait(stdx::unique_lock<stdx::mutex>& lk, + uint64_t prevVersion, + Microseconds timeout) const { while (!_dead && prevVersion == _version) { - if (stdx::cv_status::timeout == _notifier.wait_until(lk, deadline.toSystemTimePoint())) { + if (timeout == Microseconds::max()) { + _notifier.wait(lk); + } else if (stdx::cv_status::timeout == _notifier.wait_for(lk, timeout.toSystemDuration())) { return; } } } +void CappedInsertNotifier::wait(uint64_t prevVersion, Microseconds timeout) const { + stdx::unique_lock<stdx::mutex> lk(_mutex); + _wait(lk, prevVersion, timeout); +} + +void CappedInsertNotifier::wait(Microseconds timeout) const { + stdx::unique_lock<stdx::mutex> lk(_mutex); + _wait(lk, _version, timeout); +} + +void CappedInsertNotifier::wait() const { + stdx::unique_lock<stdx::mutex> lk(_mutex); + _wait(lk, _version, Microseconds::max()); +} + void CappedInsertNotifier::kill() { stdx::lock_guard<stdx::mutex> lk(_mutex); _dead = true; |