Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::interface7::internal::delegated_task Class Reference
Inheritance diagram for tbb::interface7::internal::delegated_task:
Collaboration diagram for tbb::interface7::internal::delegated_task:

Public Member Functions

 delegated_task (internal::delegate_base &d, concurrent_monitor &s, task *t)
 
bool operator() (uintptr_t ctx) const
 
- Public Member Functions inherited from tbb::task
virtual ~task ()
 Destructor. More...
 
internal::allocate_continuation_proxy & allocate_continuation ()
 Returns proxy for overloaded new that allocates a continuation task of *this. More...
 
internal::allocate_child_proxy & allocate_child ()
 Returns proxy for overloaded new that allocates a child task of *this. More...
 
void recycle_as_continuation ()
 Change this to be a continuation of its former self. More...
 
void recycle_as_safe_continuation ()
 Recommended to use, safe variant of recycle_as_continuation. More...
 
void recycle_as_child_of (task &new_parent)
 Change this to be a child of new_parent. More...
 
void recycle_to_reexecute ()
 Schedule this for reexecution after current execute() returns. More...
 
void set_ref_count (int count)
 Set reference count. More...
 
void increment_ref_count ()
 Atomically increment reference count. More...
 
int add_ref_count (int count)
 Atomically adds to reference count and returns its new value. More...
 
int decrement_ref_count ()
 Atomically decrement reference count and returns its new value. More...
 
void spawn_and_wait_for_all (task &child)
 Similar to spawn followed by wait_for_all, but more efficient. More...
 
void __TBB_EXPORTED_METHOD spawn_and_wait_for_all (task_list &list)
 Similar to spawn followed by wait_for_all, but more efficient. More...
 
void wait_for_all ()
 Wait for reference count to become one, and set reference count to zero. More...
 
taskparent () const
 task on whose behalf this task is working, or NULL if this is a root. More...
 
void set_parent (task *p)
 sets parent task pointer to specified value More...
 
task_group_contextcontext ()
 This method is deprecated and will be removed in the future. More...
 
task_group_contextgroup ()
 Pointer to the task group descriptor. More...
 
bool is_stolen_task () const
 True if task was stolen from the task pool of another thread. More...
 
state_type state () const
 Current execution state. More...
 
int ref_count () const
 The internal reference count. More...
 
bool __TBB_EXPORTED_METHOD is_owned_by_current_thread () const
 Obsolete, and only retained for the sake of backward compatibility. Always returns true. More...
 
void set_affinity (affinity_id id)
 Set affinity for this task. More...
 
affinity_id affinity () const
 Current affinity of this task. More...
 
virtual void __TBB_EXPORTED_METHOD note_affinity (affinity_id id)
 Invoked by scheduler to notify task that it ran on unexpected thread. More...
 
void __TBB_EXPORTED_METHOD change_group (task_group_context &ctx)
 Moves this task from its current group into another one. More...
 
bool cancel_group_execution ()
 Initiates cancellation of all tasks in this cancellation group and its subordinate groups. More...
 
bool is_cancelled () const
 Returns true if the context has received cancellation request. More...
 
void set_group_priority (priority_t p)
 Changes priority of the task group this task belongs to. More...
 
priority_t group_priority () const
 Retrieves current priority of the task group this task belongs to. More...
 

Private Member Functions

taskexecute () __TBB_override
 Should be overridden by derived classes. More...
 
 ~delegated_task ()
 

Private Attributes

internal::delegate_base & my_delegate
 
concurrent_monitormy_monitor
 
taskmy_root
 

Additional Inherited Members

- Public Types inherited from tbb::task
enum  state_type {
  executing, reexecute, ready, allocated,
  freed, recycle
}
 Enumeration of task states that the scheduler considers. More...
 
typedef internal::affinity_id affinity_id
 An id as used for specifying affinity. More...
 
- Static Public Member Functions inherited from tbb::task
static internal::allocate_root_proxy allocate_root ()
 Returns proxy for overloaded new that allocates a root task. More...
 
static internal::allocate_root_with_context_proxy allocate_root (task_group_context &ctx)
 Returns proxy for overloaded new that allocates a root task associated with user supplied context. More...
 
static void spawn_root_and_wait (task &root)
 Spawn task allocated by allocate_root, wait for it to complete, and deallocate it. More...
 
static void spawn_root_and_wait (task_list &root_list)
 Spawn root tasks on list and wait for all of them to finish. More...
 
static void enqueue (task &t)
 Enqueue task for starvation-resistant execution. More...
 
static void enqueue (task &t, priority_t p)
 Enqueue task for starvation-resistant execution on the specified priority level. More...
 
static void enqueue (task &t, task_arena &arena, priority_t p=priority_t(0))
 Enqueue task in task_arena. More...
 
static task &__TBB_EXPORTED_FUNC self ()
 The innermost task being executed or destroyed by the current thread at the moment. More...
 
- Protected Member Functions inherited from tbb::task
 task ()
 Default constructor. More...
 

Detailed Description

Definition at line 809 of file arena.cpp.

Constructor & Destructor Documentation

◆ ~delegated_task()

tbb::interface7::internal::delegated_task::~delegated_task ( )
inlineprivate

Definition at line 845 of file arena.cpp.

845  {
846  // potential exception was already registered. It must happen before the notification
847  __TBB_ASSERT(my_root->ref_count()==2, NULL);
848  __TBB_store_with_release(my_root->prefix().ref_count, 1); // must precede the wakeup
849  my_monitor.notify(*this); // do not relax, it needs a fence!
850  }
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
void notify(const P &predicate)
Notify waiting threads of the event that satisfies the given predicate.
int ref_count() const
The internal reference count.
Definition: task.h:867
internal::task_prefix & prefix(internal::version_tag *=NULL) const
Get reference to corresponding task_prefix.
Definition: task.h:946

References __TBB_ASSERT, tbb::internal::__TBB_store_with_release(), my_monitor, my_root, tbb::internal::concurrent_monitor::notify(), tbb::task::prefix(), and tbb::task::ref_count().

Here is the call graph for this function:

◆ delegated_task()

tbb::interface7::internal::delegated_task::delegated_task ( internal::delegate_base &  d,
concurrent_monitor s,
task t 
)
inline

Definition at line 852 of file arena.cpp.

853  : my_delegate(d), my_monitor(s), my_root(t) {}
void const char const char int ITT_FORMAT __itt_group_sync s
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
internal::delegate_base & my_delegate
Definition: arena.cpp:810

Member Function Documentation

◆ execute()

task* tbb::interface7::internal::delegated_task::execute ( )
inlineprivatevirtual

Should be overridden by derived classes.

Implements tbb::task.

Definition at line 813 of file arena.cpp.

813  {
814  generic_scheduler& s = *(generic_scheduler*)prefix().owner;
815  __TBB_ASSERT(s.outermost_level(), "expected to be enqueued and received on the outermost level");
816  struct outermost_context : internal::no_copy {
817  delegated_task * t;
818  generic_scheduler & s;
819  task * orig_dummy;
820  task_group_context * orig_ctx;
821  scheduler_properties orig_props;
822  outermost_context(delegated_task *_t, generic_scheduler &_s)
823  : t(_t), s(_s), orig_dummy(s.my_dummy_task), orig_props(s.my_properties) {
824  __TBB_ASSERT(s.my_innermost_running_task == t, NULL);
825 #if __TBB_TASK_GROUP_CONTEXT
826  orig_ctx = t->prefix().context;
827  t->prefix().context = s.my_arena->my_default_ctx;
828 #endif
829  // Mimics outermost master
830  s.my_dummy_task = t;
831  s.my_properties.type = scheduler_properties::master;
832  }
833  ~outermost_context() {
834 #if __TBB_TASK_GROUP_CONTEXT
835  // Restore context for sake of registering potential exception
836  t->prefix().context = orig_ctx;
837 #endif
838  s.my_properties = orig_props;
839  s.my_dummy_task = orig_dummy;
840  }
841  } scope(this, s);
842  my_delegate();
843  return NULL;
844  }
task()
Default constructor.
Definition: task.h:599
void const char const char int ITT_FORMAT __itt_group_sync s
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
delegated_task(internal::delegate_base &d, concurrent_monitor &s, task *t)
Definition: arena.cpp:852
internal::delegate_base & my_delegate
Definition: arena.cpp:810
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 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 __itt_event ITT_FORMAT __itt_group_mark d void const wchar_t const wchar_t int ITT_FORMAT __itt_group_sync __itt_group_fsync x void const wchar_t int const wchar_t int int ITT_FORMAT __itt_group_sync __itt_group_fsync x void ITT_FORMAT __itt_group_sync __itt_group_fsync p void ITT_FORMAT __itt_group_sync __itt_group_fsync p void size_t ITT_FORMAT lu no args __itt_obj_prop_t __itt_obj_state_t ITT_FORMAT d const char ITT_FORMAT s __itt_frame ITT_FORMAT p const char const char ITT_FORMAT s __itt_counter ITT_FORMAT p __itt_counter unsigned long long ITT_FORMAT lu const wchar_t ITT_FORMAT S __itt_mark_type const wchar_t ITT_FORMAT S __itt_mark_type const char ITT_FORMAT s __itt_mark_type ITT_FORMAT d __itt_caller ITT_FORMAT p __itt_caller ITT_FORMAT p no args const __itt_domain __itt_clock_domain unsigned long long __itt_id ITT_FORMAT lu const __itt_domain __itt_clock_domain unsigned long long __itt_id __itt_id void ITT_FORMAT p const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_clock_domain unsigned long long __itt_id __itt_string_handle __itt_scope scope
internal::task_prefix & prefix(internal::version_tag *=NULL) const
Get reference to corresponding task_prefix.
Definition: task.h:946

References __TBB_ASSERT, tbb::internal::scheduler_properties::master, my_delegate, tbb::task::prefix(), s, and scope.

Here is the call graph for this function:

◆ operator()()

bool tbb::interface7::internal::delegated_task::operator() ( uintptr_t  ctx) const
inline

Definition at line 855 of file arena.cpp.

855 { return (void*)ctx == (void*)&my_delegate; }
internal::delegate_base & my_delegate
Definition: arena.cpp:810

References my_delegate.

Member Data Documentation

◆ my_delegate

internal::delegate_base& tbb::interface7::internal::delegated_task::my_delegate
private

Definition at line 810 of file arena.cpp.

Referenced by execute(), and operator()().

◆ my_monitor

concurrent_monitor& tbb::interface7::internal::delegated_task::my_monitor
private

Definition at line 811 of file arena.cpp.

Referenced by ~delegated_task().

◆ my_root

task* tbb::interface7::internal::delegated_task::my_root
private

Definition at line 812 of file arena.cpp.

Referenced by ~delegated_task().


The documentation for this class was generated from the following file:

Copyright © 2005-2019 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.