Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: base/synchronization/condition_variable_win.cc

Issue 2373363002: Test lock checks.
Patch Set: another test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/synchronization/lock.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/synchronization/condition_variable.h" 5 #include "base/synchronization/condition_variable.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 10
(...skipping 22 matching lines...) Expand all
33 #if DCHECK_IS_ON() 33 #if DCHECK_IS_ON()
34 user_lock_->CheckHeldAndUnmark(); 34 user_lock_->CheckHeldAndUnmark();
35 #endif 35 #endif
36 36
37 if (!SleepConditionVariableSRW(&cv_, srwlock_, timeout, 0)) { 37 if (!SleepConditionVariableSRW(&cv_, srwlock_, timeout, 0)) {
38 // On failure, we only expect the CV to timeout. Any other error value means 38 // On failure, we only expect the CV to timeout. Any other error value means
39 // that we've unexpectedly woken up. 39 // that we've unexpectedly woken up.
40 // Note that WAIT_TIMEOUT != ERROR_TIMEOUT. WAIT_TIMEOUT is used with the 40 // Note that WAIT_TIMEOUT != ERROR_TIMEOUT. WAIT_TIMEOUT is used with the
41 // WaitFor* family of functions as a direct return value. ERROR_TIMEOUT is 41 // WaitFor* family of functions as a direct return value. ERROR_TIMEOUT is
42 // used with GetLastError(). 42 // used with GetLastError().
43 DCHECK_EQ(static_cast<DWORD>(ERROR_TIMEOUT), GetLastError()); 43 CHECK_EQ(static_cast<DWORD>(ERROR_TIMEOUT), GetLastError());
44 } 44 }
45 45
46 #if DCHECK_IS_ON() 46 #if DCHECK_IS_ON()
47 user_lock_->CheckUnheldAndMark(); 47 user_lock_->CheckUnheldAndMark();
48 #endif 48 #endif
49 } 49 }
50 50
51 void ConditionVariable::Broadcast() { 51 void ConditionVariable::Broadcast() {
52 WakeAllConditionVariable(&cv_); 52 WakeAllConditionVariable(&cv_);
53 } 53 }
54 54
55 void ConditionVariable::Signal() { 55 void ConditionVariable::Signal() {
56 WakeConditionVariable(&cv_); 56 WakeConditionVariable(&cv_);
57 } 57 }
58 58
59 } // namespace base 59 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/synchronization/lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698