Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::internal::task_prefix Class Reference

Memory prefix to a task object. More...

#include <task.h>

Collaboration diagram for tbb::internal::task_prefix:

Private Member Functions

tbb::tasktask ()
 The task corresponding to this task_prefix. More...
 

Private Attributes

isolation_tag isolation
 The tag used for task isolation. More...
 
task_group_contextcontext
 Shared context that is used to communicate asynchronous state changes. More...
 
schedulerorigin
 The scheduler that allocated the task, or NULL if the task is big. More...
 
union {
   scheduler *   owner
 Obsolete. The scheduler that owns the task. More...
 
   task *   next_offloaded
 Pointer to the next offloaded lower priority task. More...
 
}; 
 
tbb::taskparent
 The task whose reference count includes me. More...
 
__TBB_atomic reference_count ref_count
 Reference count used for synchronization. More...
 
int depth
 Obsolete. Used to be scheduling depth before TBB 2.2. More...
 
unsigned char state
 A task::state_type, stored as a byte for compactness. More...
 
unsigned char extra_state
 Miscellaneous state that is not directly visible to users, stored as a byte for compactness. More...
 
affinity_id affinity
 
tbb::tasknext
 "next" field for list of task More...
 

Friends

class tbb::task
 
class tbb::interface5::internal::task_base
 
class tbb::task_list
 
class internal::scheduler
 
class internal::allocate_root_proxy
 
class internal::allocate_child_proxy
 
class internal::allocate_continuation_proxy
 
class internal::allocate_additional_child_of_proxy
 
void make_critical (task &)
 
bool is_critical (task &)
 

Detailed Description

Memory prefix to a task object.

This class is internal to the library. Do not reference it directly, except within the library itself. Fields are ordered in way that preserves backwards compatibility and yields good packing on typical 32-bit and 64-bit platforms. New fields should be added at the beginning for backward compatibility with accesses to the task prefix inlined into application code. To prevent ODR violation, the class shall have the same layout in all application translation units. If some fields are conditional (e.g. enabled by preview macros) and might get skipped, use reserved fields to adjust the layout.

In case task prefix size exceeds 32 or 64 bytes on IA32 and Intel64 architectures correspondingly, consider dynamic setting of task_alignment and task_prefix_reservation_size based on the maximal operand size supported by the current CPU.

Definition at line 203 of file task.h.

Member Function Documentation

◆ task()

tbb::task& tbb::internal::task_prefix::task ( )
inlineprivate

The task corresponding to this task_prefix.

Definition at line 300 of file task.h.

300 {return *reinterpret_cast<tbb::task*>(this+1);}

Friends And Related Function Documentation

◆ internal::allocate_additional_child_of_proxy

Definition at line 212 of file task.h.

◆ internal::allocate_child_proxy

friend class internal::allocate_child_proxy
friend

Definition at line 210 of file task.h.

◆ internal::allocate_continuation_proxy

Definition at line 211 of file task.h.

◆ internal::allocate_root_proxy

friend class internal::allocate_root_proxy
friend

Definition at line 209 of file task.h.

◆ internal::scheduler

friend class internal::scheduler
friend

Definition at line 208 of file task.h.

◆ is_critical

bool is_critical ( task t)
friend

Definition at line 1014 of file task.h.

1014 { return bool((t.prefix().extra_state & 0x8) != 0); }

◆ make_critical

void make_critical ( task t)
friend

Definition at line 1013 of file task.h.

1013 { t.prefix().extra_state |= 0x8; }

◆ tbb::interface5::internal::task_base

Definition at line 206 of file task.h.

◆ tbb::task

friend class tbb::task
friend

Definition at line 205 of file task.h.

◆ tbb::task_list

friend class tbb::task_list
friend

Definition at line 207 of file task.h.

Member Data Documentation

◆ @44

union { ... }

◆ affinity

affinity_id tbb::internal::task_prefix::affinity
private

◆ context

◆ depth

int tbb::internal::task_prefix::depth
private

Obsolete. Used to be scheduling depth before TBB 2.2.

Retained only for the sake of backward binary compatibility. Not used by TBB anymore.

Definition at line 279 of file task.h.

◆ extra_state

unsigned char tbb::internal::task_prefix::extra_state
private

Miscellaneous state that is not directly visible to users, stored as a byte for compactness.

0x0 -> version 1.0 task 0x1 -> version >=2.1 task 0x10 -> task was enqueued 0x20 -> task_proxy 0x40 -> task has live ref_count 0x80 -> a stolen task

Definition at line 292 of file task.h.

Referenced by tbb::internal::arena::enqueue_task(), tbb::internal::is_critical(), tbb::internal::generic_scheduler::is_proxy(), tbb::internal::generic_scheduler::is_version_3_task(), tbb::internal::make_critical(), tbb::internal::reset_extra_state(), and tbb::internal::generic_scheduler::steal_task().

◆ isolation

◆ next

◆ next_offloaded

task* tbb::internal::task_prefix::next_offloaded

Pointer to the next offloaded lower priority task.

Used to maintain a list of offloaded tasks inside the scheduler.

Definition at line 252 of file task.h.

Referenced by tbb::internal::custom_scheduler< SchedulerTraits >::process_bypass_loop().

◆ origin

scheduler* tbb::internal::task_prefix::origin
private

The scheduler that allocated the task, or NULL if the task is big.

Small tasks are pooled by the scheduler that allocated the task. If a scheduler needs to free a small task allocated by another scheduler, it returns the task to that other scheduler. This policy avoids memory space blowup issues for memory allocators that allocate from thread-specific pools.

Definition at line 239 of file task.h.

Referenced by tbb::internal::generic_scheduler::allocate_task(), and tbb::internal::generic_scheduler::free_nonlocal_small_task().

◆ owner

scheduler* tbb::internal::task_prefix::owner

Obsolete. The scheduler that owns the task.

Retained only for the sake of backward binary compatibility. Still used by inline methods in the task.h header.

Definition at line 247 of file task.h.

Referenced by tbb::task::enqueue(), tbb::internal::custom_scheduler< SchedulerTraits >::process_bypass_loop(), tbb::interface5::internal::task_base::spawn(), tbb::task::spawn_root_and_wait(), and tbb::internal::generic_scheduler::steal_task().

◆ parent

tbb::task* tbb::internal::task_prefix::parent
private

The task whose reference count includes me.

In the "blocking style" of programming, this field points to the parent task. In the "continuation-passing style" of programming, this field points to the continuation of the parent.

Definition at line 267 of file task.h.

Referenced by tbb::internal::allocate_continuation_proxy::allocate(), and tbb::internal::generic_scheduler::local_spawn_root_and_wait().

◆ ref_count

__TBB_atomic reference_count tbb::internal::task_prefix::ref_count
private

Reference count used for synchronization.

In the "continuation-passing style" of programming, this field is the difference of the number of allocated children minus the number of children that have completed. In the "blocking style" of programming, this field is one more than the difference.

Definition at line 274 of file task.h.

Referenced by tbb::internal::generic_scheduler::create_master(), tbb::interface5::internal::task_base::destroy(), tbb::internal::generic_scheduler::generic_scheduler(), tbb::internal::generic_scheduler::local_spawn_root_and_wait(), tbb::internal::custom_scheduler< SchedulerTraits >::process_bypass_loop(), and tbb::internal::generic_scheduler::wait_until_empty().

◆ state


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.