17 #ifndef __TBB_task_group_H 18 #define __TBB_task_group_H 24 #if __TBB_TASK_GROUP_CONTEXT 37 template<
typename _F>
friend class internal::task_handle_task;
41 static const intptr_t scheduled = 0x1;
48 if ( my_state & scheduled )
50 my_state |= scheduled;
54 #if __TBB_CPP11_RVALUE_REF_PRESENT 58 void operator() ()
const { my_func(); }
112 template<
typename Task,
typename F>
114 owner().spawn( *
new( owner().allocate_additional_child_of(*my_root) ) Task( internal::forward<F>(f) ));
127 #if __TBB_CPP17_UNCAUGHT_EXCEPTIONS_PRESENT 128 bool stack_unwinding_in_progress = std::uncaught_exceptions() > 0;
130 bool stack_unwinding_in_progress = std::uncaught_exception();
134 if ( !is_canceling() )
139 task::destroy(*my_root);
142 task::destroy(*my_root);
143 if ( !stack_unwinding_in_progress )
147 task::destroy(*my_root);
153 internal_run< internal::task_handle_task<F> >(
h );
189 internal_run< internal::task_handle_task<F> >(
h );
195 #if __TBB_CPP11_RVALUE_REF_PRESENT 202 void run(
const F& f) {
203 internal_run<internal::function_task<F> >(f);
209 return internal_run_and_wait<const F>( f );
216 return internal_run_and_wait< task_handle<F> >(
h );
226 return internal_run_and_wait< task_handle<F> >(
h );
231 my_root->set_ref_count(1);
241 #if __TBB_CPP11_RVALUE_REF_PRESENT task_group_status run_and_wait(task_handle< F > &h)
void set_ref_count(int count)
Set reference count.
task_handle< typename internal::strip< F >::type > make_task(F &&f)
~task_group_base() __TBB_NOEXCEPT(false)
void __TBB_EXPORTED_METHOD register_pending_exception()
Records the pending exception, and cancels the task group.
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
void __TBB_EXPORTED_METHOD reset()
Forcefully reinitializes the context after the task tree it was associated with is completed...
task_group_context my_context
task_handle< F > & my_handle
task * execute() __TBB_override
Should be overridden by derived classes.
task_group_status run_and_wait(const F &f)
bool __TBB_EXPORTED_METHOD cancel_group_execution()
Initiates cancellation of all tasks in this cancellation group and its subordinate groups...
void run(task_handle< F > &h)
int decrement_ref_count()
Atomically decrement reference count and returns its new value.
task_group_base(uintptr_t traits=0)
bool is_cancelled() const
Returns true if the context has received cancellation request.
#define __TBB_NOEXCEPT(expression)
task_group_status run_and_wait(task_handle< F > &h)
static task &__TBB_EXPORTED_FUNC self()
The innermost task being executed or destroyed by the current thread at the moment.
void move(tbb_thread &t1, tbb_thread &t2)
task_group_status internal_run_and_wait(F &f)
task that does nothing. Useful for synchronization.
#define __TBB_FORWARDING_REF(A)
Used to form groups of tasks.
task_handle_task(task_handle< F > &h)
bool is_current_task_group_canceling()
int ref_count() const
The internal reference count.
bool __TBB_EXPORTED_METHOD is_group_execution_cancelled() const
Returns true if the context received cancellation request.
Base class for user-defined tasks.
void wait_for_all()
Wait for reference count to become one, and set reference count to zero.
void internal_run(__TBB_FORWARDING_REF(F) f)
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
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_id __itt_string_handle __itt_metadata_type type
void increment_ref_count()
Atomically increment reference count.
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 h