1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_BARRIER_CLOSURE_H_
6 #define BASE_BARRIER_CLOSURE_H_
8 #include "base/base_export.h"
9 #include "base/callback.h"
13 // BarrierClosure executes |done_closure| after it has been invoked
14 // |num_closures| times.
16 // If |num_closures| is 0, |done_closure| is executed immediately.
18 // BarrierClosure is thread-safe - the count of remaining closures is
19 // maintained as a base::AtomicRefCount. |done_closure| will be run on
20 // the thread that calls the final Run() on the returned closures.
22 // |done_closure| is also cleared on the final calling thread.
23 BASE_EXPORT RepeatingClosure BarrierClosure(size_t num_closures,
24 OnceClosure done_closure);
28 #endif // BASE_BARRIER_CLOSURE_H_