Logo Search packages:      
Sourcecode: tbb version File versions  Download package

tbb::task Class Reference
[Task Scheduling]

#include <task.h>

Inheritance diagram for tbb::task:

ConcurrentHashSerialFibTask FibTask QueueInsertTask QueueProcessTask tbb::empty_task UnconstructibleTask

List of all members.


Detailed Description

Base class for user-defined tasks.

Definition at line 162 of file task.h.


Public Types

enum  state_type {
  executing, reexecute, ready, allocated,
  freed, recycle
}
 Enumeration of task states that the scheduler considers. More...

Public Member Functions

internal::allocate_additional_child_of_proxy allocate_additional_child_of (task &t)
 Like allocate_child, except that task's parent becomes "t", not this.
internal::allocate_child_proxy & allocate_child ()
 Returns proxy for overloaded new that allocates a child task of *this.
internal::allocate_continuation_proxy & allocate_continuation ()
 Returns proxy for overloaded new that allocates a continuation task of *this.
void destroy (task &victim)
 Destroy a task.
virtual taskexecute ()=0
 Should be overriden by derived classes.
void recycle_as_child_of (task &new_parent)
 Change this to be a child of new_parent.
void recycle_as_continuation ()
 Change this to be a continuation of its former self.
void recycle_as_safe_continuation ()
 Recommended to use, safe variant of recycle_as_continuation.
void recycle_to_reexecute ()
 Schedule this for reexecution after current execute() returns.
virtual ~task ()
 Destructor.

Static Public Member Functions

static
internal::allocate_root_proxy 
allocate_root ()
 Returns proxy for overloaded new that allocates a root task.

Protected Member Functions

 task ()
 Default constructor.

Package Functions

void add_to_depth (int delta)
 Change scheduling depth by given amount.
depth_type depth () const
 Scheduling depth.
bool is_owned_by_current_thread () const
 True if this task is owned by the calling thread; false otherwise.
bool is_stolen_task () const
 True if task is owned by different thread than thread that owns its parent.
taskparent () const
 task on whose behalf this task is working, or NULL if this is a root.
int ref_count () const
 The internal reference count.
void set_depth (depth_type new_depth)
 Set scheduling depth to given value.
void set_ref_count (int count)
 Set reference count.
void spawn (task_list &list)
 Spawn multiple tasks and clear list.
void spawn (task &child)
 Schedule task for execution when a worker becomes available.
void spawn_and_wait_for_all (task_list &list)
 Similar to spawn followed by wait_for_all, but more efficient.
void spawn_and_wait_for_all (task &child)
 Similar to spawn followed by wait_for_all, but more efficient.
state_type state () const
 Current execution state.
void wait_for_all ()
 Wait for reference count to become one, and set reference count to zero.

Static Package Functions

static taskself ()
 The task() current being run by this thread.
static void spawn_root_and_wait (task_list &root_list)
 Spawn root tasks on list and wait for all of them to finish.
static void spawn_root_and_wait (task &root)
 Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.

Package Attributes

 __pad0__:intptr depth_type
 A scheduling depth.

Private Member Functions

void internal_set_ref_count (int count)
 Set reference count.
internal::task_prefix & prefix () const
 Get reference to corresponding task_prefix.

Friends

class internal::allocate_additional_child_of_proxy
class internal::allocate_child_proxy
class internal::allocate_continuation_proxy
class internal::allocate_root_proxy
class internal::scheduler
class task_list

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

Generated by  Doxygen 1.6.0   Back to index