diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-01-14 16:16:06 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-01-15 10:41:45 -0500 |
commit | fb734fd9183e2929cc48d51988110c76d0d250a7 (patch) | |
tree | 9200b06635183714de737f7a11263528936065c1 | |
parent | 8d5d775b843d7566ca60a087ea17a512f67c3dc9 (diff) | |
download | mongo-fb734fd9183e2929cc48d51988110c76d0d250a7.tar.gz |
SERVER-16763 Wait infinitely when no timeout has been requested
-rw-r--r-- | src/mongo/db/concurrency/lock_state.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp index 0ab66ee22e1..1b9c3218db5 100644 --- a/src/mongo/db/concurrency/lock_state.cpp +++ b/src/mongo/db/concurrency/lock_state.cpp @@ -701,6 +701,8 @@ namespace { // deadlock detection. unsigned waitTimeMs = std::min(timeoutMs, DeadlockTimeoutMs); while (true) { + // It is OK if this call wakes up spuriously, because we re-evaluate the remaining + // wait time anyways. result = _notify.wait(waitTimeMs); // Account for the time spent waiting on the notification object @@ -723,6 +725,9 @@ namespace { } } + // If infinite timeout was requested, just keep waiting + if (timeoutMs == UINT_MAX) continue; + const unsigned elapsedTimeMs = elapsedTimeMicros / 1000; waitTimeMs = (elapsedTimeMs < timeoutMs) ? std::min(timeoutMs - elapsedTimeMs, DeadlockTimeoutMs) : 0; |