| OLD | NEW |
| 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <stack> | 8 #include <stack> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 // Free list for old events. | 199 // Free list for old events. |
| 200 Event recycling_list_; | 200 Event recycling_list_; |
| 201 int recycling_list_size_; | 201 int recycling_list_size_; |
| 202 | 202 |
| 203 // The number of allocated, but not yet deleted events. | 203 // The number of allocated, but not yet deleted events. |
| 204 int allocation_counter_; | 204 int allocation_counter_; |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 WinXPCondVar::WinXPCondVar(Lock* user_lock) | 207 WinXPCondVar::WinXPCondVar(Lock* user_lock) |
| 208 : user_lock_(*user_lock), | 208 : run_state_(RUNNING), |
| 209 run_state_(RUNNING), | 209 user_lock_(*user_lock), |
| 210 allocation_counter_(0), | 210 recycling_list_size_(0), |
| 211 recycling_list_size_(0) { | 211 allocation_counter_(0) { |
| 212 DCHECK(user_lock); | 212 DCHECK(user_lock); |
| 213 } | 213 } |
| 214 | 214 |
| 215 WinXPCondVar::~WinXPCondVar() { | 215 WinXPCondVar::~WinXPCondVar() { |
| 216 AutoLock auto_lock(internal_lock_); | 216 AutoLock auto_lock(internal_lock_); |
| 217 run_state_ = SHUTDOWN; // Prevent any more waiting. | 217 run_state_ = SHUTDOWN; // Prevent any more waiting. |
| 218 | 218 |
| 219 DCHECK_EQ(recycling_list_size_, allocation_counter_); | 219 DCHECK_EQ(recycling_list_size_, allocation_counter_); |
| 220 if (recycling_list_size_ != allocation_counter_) { // Rare shutdown problem. | 220 if (recycling_list_size_ != allocation_counter_) { // Rare shutdown problem. |
| 221 // There are threads of execution still in this->TimedWait() and yet the | 221 // There are threads of execution still in this->TimedWait() and yet the |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 660 |
| 661 void ConditionVariable::Broadcast() { | 661 void ConditionVariable::Broadcast() { |
| 662 impl_->Broadcast(); | 662 impl_->Broadcast(); |
| 663 } | 663 } |
| 664 | 664 |
| 665 void ConditionVariable::Signal() { | 665 void ConditionVariable::Signal() { |
| 666 impl_->Signal(); | 666 impl_->Signal(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 } // namespace base | 669 } // namespace base |
| OLD | NEW |