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

tbb::internal::GenericScheduler Class Reference

Inheritance diagram for tbb::internal::GenericScheduler:

tbb::internal::CustomScheduler< SchedulerTraits >

List of all members.


Detailed Description

Cilk-style task scheduler.

None of the fields here are every read or written by threads other than the thread that creates the instance.

Class GenericScheduler is an abstract base class that contains most of the scheduler, except for tweaks specific to processors and tools (e.g. VTune). The derived template class CustomScheduler<SchedulerTraits> fills in the tweaks.

Definition at line 559 of file task.cpp.


Public Types

enum  hint { no_hint = 0, is_local = 1, is_small = 2, is_small_local = 3 }
 Optimization hint to free_task that enables it omit unnecessary tests and code. More...

Public Member Functions

taskallocate_task (size_t number_of_bytes, depth_type depth, task *parent)
 Allocate task object, either from the heap or a free list.
void deallocate_task (task &t)
void free_nonlocal_small_task (task &t)
 Free a small task t that that was allocated by a different scheduler.
void free_scheduler ()
 Destroy and deallocate scheduler that was created with method allocate.
template<hint h>
void free_task (task &t)
 Put task on free list.
bool is_worker ()
 True if running on a worker thread, false otherwise.
void spawn (task &first, task *&next)
void spawn_root_and_wait (task &first, task *&next)

Static Public Member Functions

static GenericSchedulerallocate_scheduler (Arena *arena)
static taskplugged_return_list ()
 Special value used to mark return_list as not taking any more entries.

Public Attributes

task *volatile return_list
 List of small tasks that have been returned to this scheduler by other schedulers.
intptr small_task_count
 Number of small tasks that have been allocated by this scheduler.

Protected Member Functions

 GenericScheduler (Arena *arena)

Private Types

enum  debug_state_t { ds_release = 0 }
 Bit masks.
typedef task::depth_type depth_type

Private Member Functions

void acquire_task_pool () const
void destroy_task (task &t)
 Call destructor for a task and put it on the free list (or free it if it is big).
taskget_task (depth_type d)
 Get task from ready pool.
void grow (TaskPool::size_type minimum_size)
 Grow "array" to at least "minimum_size" elements.
void leave_arena (bool compress)
 Leave the arena.
void release_task_pool () const
tasksteal_task (UnpaddedArenaSlot &arena_slot, depth_type d)
 Steal task from another scheduler's ready pool.
void try_enter_arena ()
 Try to enter the arena.

Static Private Member Functions

static void cleanup_worker_thread (void *arg)
 Called by slave threads to free memory and wait for other threads.
static GenericSchedulercreate_master (Arena *a)
static GenericSchedulercreate_worker (WorkerDescriptor &w)
static void * worker_routine (void *arg)
 Top-level routine for worker threads.

Private Attributes

Arena *const arena
 The arena that I own (if master) or belong to (if worker).
UnpaddedArenaSlot * arena_slot
 Pointer to my slot in the arena.
TaskPool::size_type array_size
 The physical number of slots in "array".
depth_type deepest
 Deepest non-empty level.
UnpaddedArenaSlot dummy_slot
 Dummy slot used when scheduler is not in arena.
taskdummy_task
 Fake root task created by slave threads.
taskfree_list
 Free list of small tasks that can be reused.
taskinnermost_running_task
 Innermost task whose task::execute() is running.
Gate * open_gate
 Set to non-null temporarily when entering arena.
FastRandom random
 Random number generator used for picking a random victim from which to steal.
long ref_count
 Reference count for scheduler.

Static Private Attributes

static const size_t quick_task_size = 256-sizeof(internal::task_prefix)
 If sizeof(task) is <=quick_task_size, it is handled on a free list instead of malloc'd.

Friends

class allocate_root_proxy
class Arena
class internal::CustomScheduler
class scheduler
class tbb::task
class tbb::task_scheduler_init
struct WorkerDescriptor

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

Generated by  Doxygen 1.6.0   Back to index