OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/waitable_event.h" | 5 #include "base/waitable_event.h" |
6 | 6 |
7 #include "base/condition_variable.h" | 7 #include "base/condition_variable.h" |
8 #include "base/lock.h" | 8 #include "base/lock.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 | 10 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 return r; | 329 return r; |
330 } | 330 } |
331 | 331 |
332 // ----------------------------------------------------------------------------- | 332 // ----------------------------------------------------------------------------- |
333 | 333 |
334 | 334 |
335 // ----------------------------------------------------------------------------- | 335 // ----------------------------------------------------------------------------- |
336 // Private functions... | 336 // Private functions... |
337 | 337 |
| 338 WaitableEvent::WaitableEventKernel::WaitableEventKernel(bool manual_reset, |
| 339 bool initially_signaled) |
| 340 : manual_reset_(manual_reset), |
| 341 signaled_(initially_signaled) { |
| 342 } |
| 343 |
| 344 WaitableEvent::WaitableEventKernel::~WaitableEventKernel() { |
| 345 } |
| 346 |
338 // ----------------------------------------------------------------------------- | 347 // ----------------------------------------------------------------------------- |
339 // Wake all waiting waiters. Called with lock held. | 348 // Wake all waiting waiters. Called with lock held. |
340 // ----------------------------------------------------------------------------- | 349 // ----------------------------------------------------------------------------- |
341 bool WaitableEvent::SignalAll() { | 350 bool WaitableEvent::SignalAll() { |
342 bool signaled_at_least_one = false; | 351 bool signaled_at_least_one = false; |
343 | 352 |
344 for (std::list<Waiter*>::iterator | 353 for (std::list<Waiter*>::iterator |
345 i = kernel_->waiters_.begin(); i != kernel_->waiters_.end(); ++i) { | 354 i = kernel_->waiters_.begin(); i != kernel_->waiters_.end(); ++i) { |
346 if ((*i)->Fire(this)) | 355 if ((*i)->Fire(this)) |
347 signaled_at_least_one = true; | 356 signaled_at_least_one = true; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 return true; | 395 return true; |
387 } | 396 } |
388 } | 397 } |
389 | 398 |
390 return false; | 399 return false; |
391 } | 400 } |
392 | 401 |
393 // ----------------------------------------------------------------------------- | 402 // ----------------------------------------------------------------------------- |
394 | 403 |
395 } // namespace base | 404 } // namespace base |
OLD | NEW |