Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
17 #ifndef __TBB_task_group_H
18 #define __TBB_task_group_H
20 #define __TBB_task_group_H_include_area
26 #if TBB_PREVIEW_ISOLATED_TASK_GROUP && __TBB_TASK_ISOLATION
30 #if __TBB_TASK_GROUP_CONTEXT
40 #if TBB_PREVIEW_ISOLATED_TASK_GROUP && __TBB_TASK_ISOLATION
41 class isolated_task_group;
49 #if TBB_PREVIEW_ISOLATED_TASK_GROUP && __TBB_TASK_ISOLATION
50 friend class isolated_task_group;
66 #if __TBB_CPP11_RVALUE_REF_PRESENT
82 class task_handle_task :
public task {
122 template<
typename Task,
typename F>
124 return new( task::allocate_additional_child_of(*
my_root) ) Task( internal::forward<F>(f) );
137 #if __TBB_CPP17_UNCAUGHT_EXCEPTIONS_PRESENT
138 bool stack_unwinding_in_progress = std::uncaught_exceptions() > 0;
140 bool stack_unwinding_in_progress = std::uncaught_exception();
153 if ( !stack_unwinding_in_progress )
199 internal_run< internal::task_handle_task<F> >(
h );
205 #if __TBB_CPP11_RVALUE_REF_PRESENT
212 void run(
const F& f) {
219 return internal_run_and_wait<const F>( f );
226 return internal_run_and_wait< task_handle<F> >(
h );
236 return internal_run_and_wait< task_handle<F> >(
h );
241 my_root->set_ref_count(1);
246 #if TBB_PREVIEW_ISOLATED_TASK_GROUP && __TBB_TASK_ISOLATION
248 using interface7::internal::delegate_base;
251 class spawn_delegate :
public delegate_base {
254 task::spawn(*task_to_spawn);
257 spawn_delegate(
task* a_task) : task_to_spawn(a_task) {}
260 class wait_delegate :
public delegate_base {
269 : tg(a_group), status(tgs) {}
273 class run_wait_delegate :
public wait_delegate {
276 status = tg.run_and_wait( func );
280 : wait_delegate(a_group, tgs), func(a_func) {}
284 class isolated_task_group :
public task_group {
285 intptr_t this_isolation() {
286 return reinterpret_cast<intptr_t
>(
this);
289 isolated_task_group () : task_group() {}
291 #if __TBB_CPP11_RVALUE_REF_PRESENT
294 internal::spawn_delegate sd(
301 void run(
const F& f) {
302 internal::spawn_delegate sd( prepare_task< internal::function_task<F> >(f) );
310 internal::run_wait_delegate< const F > rwd( *
this, f, result );
318 void run( task_handle<F>&
h ) {
319 internal::spawn_delegate sd( prepare_task< internal::task_handle_task<F> >(
h) );
326 internal::run_wait_delegate< task_handle<F> > rwd( *
this,
h, result );
334 internal::wait_delegate wd( *
this, result );
340 #endif // TBB_PREVIEW_ISOLATED_TASK_GROUP && __TBB_TASK_ISOLATION
347 #if __TBB_CPP11_RVALUE_REF_PRESENT
355 return task_handle<F>( f );
364 #undef __TBB_task_group_H_include_area
task_handle< F > & my_handle
static const intptr_t scheduled
task_handle< typename internal::strip< F >::type > make_task(F &&f)
Used to form groups of tasks.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
#define __TBB_FORWARDING_REF(A)
int ref_count() const
The internal reference count.
Base class for types that should not be assigned.
task_group_status internal_run_and_wait(F &f)
task_handle_task(task_handle< F > &h)
void __TBB_EXPORTED_METHOD reset()
Forcefully reinitializes the context after the task tree it was associated with is completed.
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
void increment_ref_count()
Atomically increment reference count.
int decrement_ref_count()
Atomically decrement reference count and returns its new value.
Base class for user-defined tasks.
void __TBB_EXPORTED_FUNC isolate_within_arena(delegate_base &d, intptr_t isolation=0)
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
bool __TBB_EXPORTED_METHOD is_group_execution_cancelled() const
Returns true if the context received cancellation request.
static task &__TBB_EXPORTED_FUNC self()
The innermost task being executed or destroyed by the current thread at the moment.
task * execute() __TBB_override
bool __TBB_EXPORTED_METHOD cancel_group_execution()
Initiates cancellation of all tasks in this cancellation group and its subordinate groups.
~task_group_base() __TBB_NOEXCEPT(false)
void set_ref_count(int count)
Set reference count.
task_group_status run_and_wait(task_handle< F > &h)
void __TBB_EXPORTED_METHOD register_pending_exception()
Records the pending exception, and cancels the task group.
void wait_for_all()
Wait for reference count to become one, and set reference count to zero.
task_group_status run_and_wait(const F &f)
void move(tbb_thread &t1, tbb_thread &t2)
Base class for types that should not be copied or assigned.
task_group_status run_and_wait(task_handle< F > &h)
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 * task
task that does nothing. Useful for synchronization.
task_group_context my_context
task * prepare_task(__TBB_FORWARDING_REF(F) f)
@ eid_invalid_multiple_scheduling
#define __TBB_NOEXCEPT(expression)
task_group_base(uintptr_t traits=0)
void run(task_handle< F > &h)
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
bool is_current_task_group_canceling()
bool is_cancelled() const
Returns true if the context has received cancellation request.
Copyright © 2005-2020 Intel Corporation. All Rights Reserved.
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
* Other names and brands may be claimed as the property of others.