17 #ifndef __TBB_parallel_invoke_H    18 #define __TBB_parallel_invoke_H    20 #define __TBB_parallel_invoke_H_include_area    26 #if __TBB_VARIADIC_PARALLEL_INVOKE    32 #if !__TBB_TASK_GROUP_CONTEXT    34     struct task_group_context {
    42     template<
typename function>
    56     template <
size_t N, 
typename function1, 
typename function2, 
typename function3>
    68                 __TBB_ASSERT(N==2 || N==3, 
"Number of arguments passed to spawner is wrong");
   104 #if __TBB_VARIADIC_PARALLEL_INVOKE   108         template <
typename function>
   111             internal::function_invoker<function>* invoker = 
new (
allocate_child()) internal::function_invoker<function>(std::forward<function>(_func));
   116         template<
typename function>
   123         template <
typename function1, 
typename function2, 
typename... 
function>
   124         void add_children(function1&& _func1, function2&& _func2, 
function&&... _func)
   127             parallel_invoke_noop noop;
   128             typedef internal::spawner<2, function1, function2, parallel_invoke_noop> spawner_type;
   129             spawner_type & sub_root = *
new(
allocate_child()) spawner_type(std::forward<function1>(_func1), std::forward<function2>(_func2), noop);
   135         template <
typename function>
   145         template <
typename function1, 
typename function2>
   154         template <
typename function1, 
typename function2, 
typename function3>
   155         void add_children (
const function1& _func1, 
const function2& _func2, 
const function3& _func3)
   160 #endif // __TBB_VARIADIC_PARALLEL_INVOKE   163         template <
typename F0>
   174 #if __TBB_TASK_GROUP_CONTEXT   189 #if __TBB_VARIADIC_PARALLEL_INVOKE   191     template<
typename... T> 
struct impl_selector; 
   193     template<
typename T1, 
typename... T> 
struct impl_selector<T1, T...> {
   194         typedef typename impl_selector<T...>
::type type;
   197     template<
typename T> 
struct impl_selector<T> {
   200     template<> 
struct impl_selector<task_group_context&> {
   205     inline task_group_context& get_context( task_group_context& tgc ) { 
return tgc; }
   207     template<
typename T1, 
typename... T>
   208     task_group_context& get_context( T1&& , T&&... t )
   209     { 
return get_context( std::forward<T>(t)... ); }
   212     template<
typename F0, 
typename F1, 
typename... F>
   213     void parallel_invoke_impl(
true_type, F0&& f0, F1&& f1, F&&... f) {
   216         const size_t number_of_children = 2 + 
sizeof...(F)/2;
   217         parallel_invoke_cleaner cleaner(number_of_children, get_context(std::forward<F>(f)...));
   218         parallel_invoke_helper& root = cleaner.root;
   220         root.add_children(std::forward<F>(f)...);
   221         root.add_children(std::forward<F1>(f1));
   222         root.run_and_finish(std::forward<F0>(f0));
   226     template<
typename F0, 
typename F1, 
typename... F>
   227     void parallel_invoke_impl(
false_type, F0&& f0, F1&& f1, F&&... f) {
   230         parallel_invoke_impl(
true_type(), std::forward<F0>(f0), std::forward<F1>(f1), std::forward<F>(f)..., context);
   242 #if __TBB_VARIADIC_PARALLEL_INVOKE   246 template<
typename F0, 
typename F1, 
typename... F>
   249     internal::parallel_invoke_impl(selector_type(), std::forward<F0>(f0), std::forward<F1>(f1), std::forward<F>(f)...);
   256 template<
typename F0, 
typename F1 >
   267 template<
typename F0, 
typename F1, 
typename F2 >
   279 template<
typename F0, 
typename F1, 
typename F2, 
typename F3>
   294 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4 >
   295 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   308 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4, 
typename F5>
   309 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4, 
const F5& f5,
   322 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4, 
typename F5, 
typename F6>
   323 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   324                      const F5& f5, 
const F6& f6,
   337 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4,
   338          typename F5, 
typename F6, 
typename F7>
   339 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   340                      const F5& f5, 
const F6& f6, 
const F7& f7,
   354 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4,
   355          typename F5, 
typename F6, 
typename F7, 
typename F8>
   356 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   357                      const F5& f5, 
const F6& f6, 
const F7& f7, 
const F8& f8,
   371 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4,
   372          typename F5, 
typename F6, 
typename F7, 
typename F8, 
typename F9>
   373 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   374                      const F5& f5, 
const F6& f6, 
const F7& f7, 
const F8& f8, 
const F9& f9,
   388 template<
typename F0, 
typename F1>
   391     parallel_invoke<F0, F1>(f0, f1, context);
   394 template<
typename F0, 
typename F1, 
typename F2>
   397     parallel_invoke<F0, F1, F2>(f0, f1, f2, context);
   400 template<
typename F0, 
typename F1, 
typename F2, 
typename F3 >
   403     parallel_invoke<F0, F1, F2, F3>(f0, f1, f2, f3, context);
   406 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4>
   407 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4) {
   409     parallel_invoke<F0, F1, F2, F3, F4>(f0, f1, f2, f3, f4, context);
   412 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4, 
typename F5>
   413 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4, 
const F5& f5) {
   415     parallel_invoke<F0, F1, F2, F3, F4, F5>(f0, f1, f2, f3, f4, f5, context);
   418 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4, 
typename F5, 
typename F6>
   419 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   420                      const F5& f5, 
const F6& f6)
   423     parallel_invoke<F0, F1, F2, F3, F4, F5, F6>(f0, f1, f2, f3, f4, f5, f6, context);
   426 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4,
   427          typename F5, 
typename F6, 
typename F7>
   428 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   429                      const F5& f5, 
const F6& f6, 
const F7& f7)
   432     parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7>(f0, f1, f2, f3, f4, f5, f6, f7, context);
   435 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4,
   436          typename F5, 
typename F6, 
typename F7, 
typename F8>
   437 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   438                      const F5& f5, 
const F6& f6, 
const F7& f7, 
const F8& f8)
   441     parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7, F8>(f0, f1, f2, f3, f4, f5, f6, f7, f8, context);
   444 template<
typename F0, 
typename F1, 
typename F2, 
typename F3, 
typename F4,
   445          typename F5, 
typename F6, 
typename F7, 
typename F8, 
typename F9>
   446 void parallel_invoke(
const F0& f0, 
const F1& f1, 
const F2& f2, 
const F3& f3, 
const F4& f4,
   447                      const F5& f5, 
const F6& f6, 
const F7& f7, 
const F8& f8, 
const F9& f9)
   450     parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7, F8, F9>(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, context);
   452 #endif // __TBB_VARIADIC_PARALLEL_INVOKE   458 #undef __TBB_parallel_invoke_H_include_area bool_constant< true > true_type
 
Used to form groups of tasks.
 
void spawn_and_wait_for_all(task &child)
Similar to spawn followed by wait_for_all, but more efficient.
 
Base class for user-defined tasks.
 
task_group_context(kind_type relation_with_parent=bound, uintptr_t t=default_traits)
Default & binding constructor.
 
task * execute() __TBB_override
Should be overridden by derived classes.
 
bool_constant< false > false_type
 
function_invoker(const function &_function)
 
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d int
 
#define __TBB_STATIC_ASSERT(condition, msg)
 
const function2 & my_func2
 
const function1 & my_func1
 
internal::parallel_invoke_helper & root
 
internal::allocate_child_proxy & allocate_child()
Returns proxy for overloaded new that allocates a child task of *this.
 
void run_and_finish(const F0 &f0)
 
const function3 & my_func3
 
const function & my_function
 
task that does nothing. Useful for synchronization.
 
parallel_invoke_cleaner(int number_of_children, tbb::task_group_context &context)
 
Base class for types that should not be copied or assigned.
 
void add_children(const function &_func)
 
void set_ref_count(int count)
Set reference count.
 
~parallel_invoke_cleaner()
 
void add_children(const function1 &_func1, const function2 &_func2)
 
parallel_invoke_helper(int number_of_children)
 
task * execute() __TBB_override
Should be overridden by derived classes.
 
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
 
spawner(const function1 &_func1, const function2 &_func2, const function3 &_func3)
 
void recycle_as_safe_continuation()
Recommended to use, safe variant of recycle_as_continuation.
 
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
 
void parallel_invoke(const F0 &f0, const F1 &f1, tbb::task_group_context &context)
Executes a list of tasks in parallel and waits for all tasks to complete.
 
void add_children(const function1 &_func1, const function2 &_func2, const function3 &_func3)