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

Unified Diff: base/barrier_closure.h

Issue 22859056: Add a BarrierClosure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/barrier_closure.cc » ('j') | base/barrier_closure.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/barrier_closure.h
diff --git a/base/barrier_closure.h b/base/barrier_closure.h
new file mode 100644
index 0000000000000000000000000000000000000000..65cdd50567f804306fcbc3eef8f9e830d08af3d5
--- /dev/null
+++ b/base/barrier_closure.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_BARRIER_CLOSURE_
awong 2013/08/22 21:28:33 BASE_BARRIER_CLOSURE_ -> BASE_BARRIER_CLOSURE_H_
groby-ooo-7-16 2013/08/22 21:59:45 Done.
+#define BASE_BARRIER_CLOSURE_
+
+#include "base/base_export.h"
+#include "base/callback_forward.h"
+
+namespace base {
+
+// BarrierClosure executes |done_closure| after it has been invoked
+// |num_closures| times.
+//
+// If |num_closures| is 0, |done_closure| is executed immediately.
+//
+// BarrierClosure is thread-safe - the count of remaining closures is
+// maintained as a base::AtomicRefCount.
awong 2013/08/22 21:28:33 This should note the threading assumptions about w
groby-ooo-7-16 2013/08/22 21:59:45 Done.
+BASE_EXPORT base::Closure BarrierClosure(int num_closures,
+ const base::Closure& done_closure);
+
+} // base
awong 2013/08/22 21:28:33 } // namesapce base #endif // BASE_BARRIER_CLOS
groby-ooo-7-16 2013/08/22 21:59:45 Done.
+#endif // BASE_BARRIER_CLOSURE_
« no previous file with comments | « no previous file | base/barrier_closure.cc » ('j') | base/barrier_closure.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698