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

Side by Side Diff: base/waitable_event_posix.cc

Issue 18122: Mac build fix (Closed)
Patch Set: Created 11 years, 11 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 | « base/waitable_event.h ('k') | no next file » | 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) 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // If return value == 0: 295 // If return value == 0:
296 // The locks of the WaitableEvents have been taken in order and the Waiter has 296 // The locks of the WaitableEvents have been taken in order and the Waiter has
297 // been enqueued in the wait-list of each. None of the WaitableEvents are 297 // been enqueued in the wait-list of each. None of the WaitableEvents are
298 // currently signaled 298 // currently signaled
299 // else: 299 // else:
300 // None of the WaitableEvent locks are held. The Waiter has not been enqueued 300 // None of the WaitableEvent locks are held. The Waiter has not been enqueued
301 // in any of them and the return value is the index of the first WaitableEvent 301 // in any of them and the return value is the index of the first WaitableEvent
302 // which was signaled, from the end of the array. 302 // which was signaled, from the end of the array.
303 // ----------------------------------------------------------------------------- 303 // -----------------------------------------------------------------------------
304 // static 304 // static
305 unsigned WaitableEvent::EnqueueMany 305 size_t WaitableEvent::EnqueueMany
306 (std::pair<WaitableEvent*, size_t>* waitables, 306 (std::pair<WaitableEvent*, size_t>* waitables,
307 unsigned count, Waiter* waiter) { 307 size_t count, Waiter* waiter) {
308 if (!count) 308 if (!count)
309 return 0; 309 return 0;
310 310
311 waitables[0].first->lock_.Acquire(); 311 waitables[0].first->lock_.Acquire();
312 if (waitables[0].first->signaled_) { 312 if (waitables[0].first->signaled_) {
313 if (!waitables[0].first->manual_reset_) 313 if (!waitables[0].first->manual_reset_)
314 waitables[0].first->signaled_ = false; 314 waitables[0].first->signaled_ = false;
315 waitables[0].first->lock_.Release(); 315 waitables[0].first->lock_.Release();
316 return count; 316 return count;
317 } 317 }
318 318
319 const unsigned r = EnqueueMany(waitables + 1, count - 1, waiter); 319 const size_t r = EnqueueMany(waitables + 1, count - 1, waiter);
320 if (r) { 320 if (r) {
321 waitables[0].first->lock_.Release(); 321 waitables[0].first->lock_.Release();
322 } else { 322 } else {
323 waitables[0].first->Enqueue(waiter); 323 waitables[0].first->Enqueue(waiter);
324 } 324 }
325 325
326 return r; 326 return r;
327 } 327 }
328 328
329 // ----------------------------------------------------------------------------- 329 // -----------------------------------------------------------------------------
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return true; 383 return true;
384 } 384 }
385 } 385 }
386 386
387 return false; 387 return false;
388 } 388 }
389 389
390 // ----------------------------------------------------------------------------- 390 // -----------------------------------------------------------------------------
391 391
392 } // namespace base 392 } // namespace base
OLDNEW
« no previous file with comments | « base/waitable_event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698