37 __TBB_ASSERT( v,
"thread did not activate a task_scheduler_init object?" );
38 #if __TBB_TASK_GROUP_CONTEXT 49 __TBB_ASSERT( v,
"thread does not have initialized task_scheduler_init object?" );
50 #if __TBB_TASK_GROUP_CONTEXT 56 #if __TBB_TASK_GROUP_CONTEXT 62 __TBB_ASSERT( s,
"Scheduler auto-initialization failed?" );
63 __TBB_ASSERT( &my_context,
"allocate_root(context) argument is a dereferenced NULL pointer" );
64 task& t = s->allocate_task( size, NULL, &my_context );
71 if ( s->master_outermost_level() )
74 my_context.bind_to( s );
79 my_context.copy_fp_settings( *s->default_context() );
87 __TBB_ASSERT( v,
"thread does not have initialized task_scheduler_init object?" );
97 task* t = (task*)
this;
101 t->
prefix().parent = NULL;
107 ((task*)
this)->prefix().parent = mytask.
parent();
115 task* t = (task*)
this;
129 parent.increment_ref_count();
142 parent.internal_decrement_ref_count();
150 const size_t X_FACTOR = 4;
160 if( new_size!=my_size ) {
169 memset( my_array, 0,
sizeof(
affinity_id)*new_size );
195 __TBB_ASSERT( k>=1,
"task's reference count underflowed" );
197 ITT_NOTIFY( sync_acquired, &prefix().ref_count );
216 __TBB_ASSERT( (intptr_t)victim.
prefix().ref_count <= 1,
"Task being destroyed must not have children" );
222 "attempt to destroy child of running or corrupted parent?" );
225 parent->internal_decrement_ref_count();
248 #if __TBB_TASK_GROUP_CONTEXT 250 prefix().context = &ctx;
256 if ( s->master_outermost_level() )
static task &__TBB_EXPORTED_FUNC allocate(size_t size)
virtual void local_wait_for_all(task &parent, task *child)=0
T __TBB_load_relaxed(const volatile T &location)
void __TBB_EXPORTED_METHOD change_group(task_group_context &ctx)
Moves this task from its current group into another one.
internal::task_prefix & prefix(internal::version_tag *=NULL) const
Get reference to corresponding task_prefix.
void __TBB_store_relaxed(volatile T &location, V value)
intptr_t reference_count
A reference count.
internal::affinity_id affinity_id
An id as used for specifying affinity.
task object is freshly allocated or recycled.
void free_task(task &t)
Put task on free list.
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 new_size
void __TBB_EXPORTED_METHOD free(task &) const
void const char const char int ITT_FORMAT __itt_group_sync s
void bind_to(internal::generic_scheduler *local_sched)
Registers this context with the local scheduler and binds it to its parent context.
#define __TBB_FetchAndDecrementWrelease(P)
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 count
static generic_scheduler * local_scheduler_weak()
void __TBB_EXPORTED_METHOD free(task &) const
bool __TBB_EXPORTED_METHOD is_owned_by_current_thread() const
Obsolete, and only retained for the sake of backward compatibility. Always returns true...
size_t __TBB_EXPORTED_FUNC get_initial_auto_partitioner_divisor()
Disable caching for a small task.
void __TBB_EXPORTED_FUNC NFS_Free(void *)
Free memory allocated by NFS_Allocate.
unsigned short affinity_id
An id as used for specifying affinity.
task &__TBB_EXPORTED_METHOD allocate(size_t size) const
void clear()
Clear the list.
void __TBB_EXPORTED_METHOD internal_set_ref_count(int count)
Set reference count.
task & allocate_task(size_t number_of_bytes, __TBB_CONTEXT_ARG(task *parent, task_group_context *context))
Allocate task object, either from the heap or a free list.
static generic_scheduler * local_scheduler()
Obtain the thread-local instance of the TBB scheduler.
static void __TBB_EXPORTED_FUNC destroy(task &victim)
Destroy a task.
static const kind_type binding_required
Task is known to have been allocated by this scheduler.
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 parent
void __TBB_EXPORTED_METHOD free(task &) const
__TBB_atomic kind_type my_kind
Flavor of this context: bound or isolated.
Memory prefix to a task object.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
internal::reference_count __TBB_EXPORTED_METHOD internal_decrement_ref_count()
Decrement reference count and return its new value.
void assert_task_valid(const task *)
static task &__TBB_EXPORTED_FUNC self()
The innermost task being executed or destroyed by the current thread at the moment.
state_type state() const
Current execution state.
#define __TBB_CONTEXT_ARG(arg1, context)
__TBB_atomic reference_count ref_count
Reference count used for synchronization.
task &__TBB_EXPORTED_METHOD allocate(size_t size) const
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 sync_releasing
unsigned char extra_state
Miscellaneous state that is not directly visible to users, stored as a byte for compactness.
static void __TBB_EXPORTED_FUNC free(task &)
Used to form groups of tasks.
unsigned char state
A task::state_type, stored as a byte for compactness.
uintptr_t my_version_and_traits
Version for run-time checks and behavioral traits of the context.
task is in ready pool, or is going to be put there, or was just taken off.
void copy_fp_settings(const task_group_context &src)
Copies FPU control setting from another context.
virtual void __TBB_EXPORTED_METHOD note_affinity(affinity_id id)
Invoked by scheduler to notify task that it ran on unexpected thread.
void __TBB_EXPORTED_METHOD free(task &) const
task object is on free list, or is going to be put there, or was just taken off.
#define ITT_NOTIFY(name, obj)
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
void __TBB_EXPORTED_METHOD resize(unsigned factor)
Resize my_array.
void spawn_and_wait_for_all(task &child)
Similar to spawn followed by wait_for_all, but more efficient.
Set if ref_count might be changed by another thread. Used for debugging.
Base class for user-defined tasks.
Work stealing task scheduler.
task * parent() const
task on whose behalf this task is working, or NULL if this is a root.
task &__TBB_EXPORTED_METHOD allocate(size_t size) const
unsigned max_threads_in_arena()
Returns the concurrency limit of the current arena.
Identifiers declared inside namespace internal should never be used directly by client code...
void const char const char int ITT_FORMAT __itt_group_sync p
task * my_innermost_running_task
Innermost task whose task::execute() is running. A dummy task on the outermost level.
void local_spawn(task *first, task *&next)
task &__TBB_EXPORTED_METHOD allocate(size_t size) const
virtual ~task()
Destructor.
#define ITT_STACK_CREATE(obj)
task_group_context * context
Shared context that is used to communicate asynchronous state changes.
__itt_caller itt_caller
Used to set and maintain stack stitching point for Intel Performance Tools.
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 size
void assert_task_pool_valid() const
void *__TBB_EXPORTED_FUNC NFS_Allocate(size_t n_element, size_t element_size, void *hint)
Allocate memory on cache/sector line boundary.