Commit 4197b467 authored by robliao's avatar robliao Committed by Commit bot

Add Some Comments to the Timeout Checks on Condition Variables

BUG=619037

Review-Url: https://codereview.chromium.org/2341773003
Cr-Commit-Position: refs/heads/master@{#418655}
parent 315e4cfd
......@@ -118,6 +118,8 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) {
#endif // OS_ANDROID && HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC
#endif // OS_MACOSX
// On failure, we only expect the CV to timeout. Any other error value means
// that we've unexpectedly woken up.
DCHECK(rv == 0 || rv == ETIMEDOUT);
#if DCHECK_IS_ON()
user_lock_->CheckUnheldAndMark();
......
......@@ -35,6 +35,11 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) {
#endif
if (!SleepConditionVariableSRW(&cv_, srwlock_, timeout, 0)) {
// On failure, we only expect the CV to timeout. Any other error value means
// that we've unexpectedly woken up.
// Note that WAIT_TIMEOUT != ERROR_TIMEOUT. WAIT_TIMEOUT is used with the
// WaitFor* family of functions as a direct return value. ERROR_TIMEOUT is
// used with GetLastError().
DCHECK_EQ(static_cast<DWORD>(ERROR_TIMEOUT), GetLastError());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment