diff options
author | Ben Caimano <ben.caimano@mongodb.com> | 2019-10-09 21:40:44 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-09 21:40:44 +0000 |
commit | 97ffc69bea04758e1c7f94e1075ef2bcce652999 (patch) | |
tree | d7706b8bb2fad8458febc2c5fac9f570ccbab966 /src/mongo/util/clock_source.h | |
parent | 906ac3ca78d352df2d0dd45350195251efe0dea1 (diff) | |
download | mongo-97ffc69bea04758e1c7f94e1075ef2bcce652999.tar.gz |
SERVER-43800 ClockSource::waitForConditionUntil shouldn't use unique_lock out of line
Diffstat (limited to 'src/mongo/util/clock_source.h')
-rw-r--r-- | src/mongo/util/clock_source.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/util/clock_source.h b/src/mongo/util/clock_source.h index c27d22b1dd3..f202f67f439 100644 --- a/src/mongo/util/clock_source.h +++ b/src/mongo/util/clock_source.h @@ -55,6 +55,8 @@ class ClockSource { std::is_function<std::remove_pointer_t<PredicateT>>::value> { }; + static constexpr auto kMaxTimeoutForArtificialClocks = Seconds(1); + public: virtual ~ClockSource() = default; @@ -90,6 +92,10 @@ public: /** * Like cv.wait_until(m, deadline), but uses this ClockSource instead of * stdx::chrono::system_clock to measure the passage of time. + * + * Note that this can suffer spurious wakeups like cw.wait_until() and, when used with a mocked + * clock source, may sleep in system time for kMaxTimeoutForArtificialClocks due to unfortunate + * implementation details. */ stdx::cv_status waitForConditionUntil(stdx::condition_variable& cv, BasicLockableAdapter m, |