Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::interface9::internal::do_group_task_input< Body, Item > Class Template Reference

#include <parallel_do.h>

Inheritance diagram for tbb::interface9::internal::do_group_task_input< Body, Item >:
Collaboration diagram for tbb::interface9::internal::do_group_task_input< Body, Item >:

Private Types

typedef parallel_do_feeder_impl< Body, Item > feeder_type
 

Private Member Functions

 do_group_task_input (feeder_type &feeder)
 
taskexecute () __TBB_override
 Should be overridden by derived classes. More...
 
 ~do_group_task_input ()
 

Private Attributes

feeder_typemy_feeder
 
size_t my_size
 
aligned_space< Item, max_arg_sizemy_arg
 

Static Private Attributes

static const size_t max_arg_size = 4
 

Friends

template<typename Iterator_ , typename Body_ , typename Item_ >
class do_task_iter
 

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...
 
- Public Member Functions inherited from tbb::task
virtual ~task ()
 Destructor. More...
 
internal::allocate_continuation_proxyallocate_continuation ()
 Returns proxy for overloaded new that allocates a continuation task of *this. More...
 
internal::allocate_child_proxyallocate_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...
 
bool is_enqueued_task () const
 True if the task was enqueued. 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...
 
__TBB_DEPRECATED void set_group_priority (priority_t p)
 Changes priority of the task group this task belongs to. More...
 
__TBB_DEPRECATED priority_t group_priority () const
 Retrieves current priority of the task group this task belongs to. 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

template<typename Body, typename Item>
class tbb::interface9::internal::do_group_task_input< Body, Item >

Definition at line 249 of file parallel_do.h.

Member Typedef Documentation

◆ feeder_type

template<typename Body , typename Item >
typedef parallel_do_feeder_impl<Body, Item> tbb::interface9::internal::do_group_task_input< Body, Item >::feeder_type
private

Definition at line 253 of file parallel_do.h.

Constructor & Destructor Documentation

◆ do_group_task_input()

template<typename Body , typename Item >
tbb::interface9::internal::do_group_task_input< Body, Item >::do_group_task_input ( feeder_type feeder)
inlineprivate

Definition at line 259 of file parallel_do.h.

◆ ~do_group_task_input()

template<typename Body , typename Item >
tbb::interface9::internal::do_group_task_input< Body, Item >::~do_group_task_input ( )
inlineprivate

Definition at line 286 of file parallel_do.h.

286  {
287  for( size_t k=0; k<my_size; ++k)
288  (my_arg.begin() + k)->~Item();
289  }
aligned_space< Item, max_arg_size > my_arg
Definition: parallel_do.h:257

References tbb::interface9::internal::do_group_task_input< Body, Item >::my_arg, and tbb::interface9::internal::do_group_task_input< Body, Item >::my_size.

Member Function Documentation

◆ execute()

template<typename Body , typename Item >
task* tbb::interface9::internal::do_group_task_input< Body, Item >::execute ( )
inlineprivatevirtual

Should be overridden by derived classes.

Implements tbb::task.

Definition at line 263 of file parallel_do.h.

264  {
265 #if __TBB_CPP11_RVALUE_REF_PRESENT
266  typedef std::move_iterator<Item*> Item_iterator;
267 #else
268  typedef Item* Item_iterator;
269 #endif
270  typedef do_iteration_task_iter<Item_iterator, Body, Item> iteration_type;
271  __TBB_ASSERT( my_size>0, NULL );
272  task_list list;
273  task* t;
274  size_t k=0;
275  for(;;) {
276  t = new( allocate_child() ) iteration_type( Item_iterator(my_arg.begin() + k), my_feeder );
277  if( ++k==my_size ) break;
278  list.push_back(*t);
279  }
280  set_ref_count(int(k+1));
281  spawn(list);
283  return NULL;
284  }
void spawn_and_wait_for_all(task &child)
Similar to spawn followed by wait_for_all, but more efficient.
Definition: task.h:800
internal::allocate_child_proxy & allocate_child()
Returns proxy for overloaded new that allocates a child task of *this.
Definition: task.h:681
friend class task_list
Definition: task.h:990
task()
Default constructor.
Definition: task.h:625
void set_ref_count(int count)
Set reference count.
Definition: task.h:761
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
aligned_space< Item, max_arg_size > my_arg
Definition: parallel_do.h:257

References __TBB_ASSERT, tbb::task::allocate_child(), tbb::interface9::internal::do_group_task_input< Body, Item >::my_arg, tbb::interface9::internal::do_group_task_input< Body, Item >::my_feeder, tbb::interface9::internal::do_group_task_input< Body, Item >::my_size, tbb::task_list::push_back(), tbb::task::set_ref_count(), and tbb::task::spawn_and_wait_for_all().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ do_task_iter

template<typename Body , typename Item >
template<typename Iterator_ , typename Body_ , typename Item_ >
friend class do_task_iter
friend

Definition at line 291 of file parallel_do.h.

Member Data Documentation

◆ max_arg_size

template<typename Body , typename Item >
const size_t tbb::interface9::internal::do_group_task_input< Body, Item >::max_arg_size = 4
staticprivate

Definition at line 251 of file parallel_do.h.

◆ my_arg

◆ my_feeder

template<typename Body , typename Item >
feeder_type& tbb::interface9::internal::do_group_task_input< Body, Item >::my_feeder
private

◆ my_size


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

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.