tbb::interface7::task_arena Class Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
tbb::interface7::task_arena Class Reference

`#include <task_arena.h>`

Inheritance diagram for tbb::interface7::task_arena:

## Classes
struct | attach
| Tag class used to indicate the "attaching" constructor. More...

## Public Member Functions
| task_arena (int max_concurrency_=automatic, unsigned reserved_for_masters=1)
| Creates task_arena with certain concurrency limits. More...
| task_arena (const task_arena &s)
| Copies settings from another task_arena.
| task_arena (attach)
| Creates an instance of task_arena attached to the current arena of the thread.
void | initialize ()
| Forces allocation of the resources for the task_arena as specified in constructor arguments.
void | initialize (int max_concurrency_, unsigned reserved_for_masters=1)
| Overrides concurrency level and forces initialization of internal representation.
void | initialize (attach)
| Attaches this instance to the current arena of the thread.
void | terminate ()
| ~task_arena ()
bool | is_active () const
template<typename F >
void | enqueue (const F &f)
template<typename F >
void | enqueue (const F &f, priority_t p)
template<typename F >
void | execute (F &f)
template<typename F >
void | execute (const F &f)
void | debug_wait_until_empty ()
int | max_concurrency () const
| Returns the maximal number of threads that can work inside the arena.

## Static Public Member Functions
static int | current_thread_index ()

## Friends
class | tbb::internal::task_scheduler_observer_v3
int | tbb::this_task_arena::max_concurrency ()

## Detailed Description

1-to-1 proxy representation class of scheduler's arena Constructors set up settings only, real construction is deferred till the first method invocation Destructor only removes one of the references to the inner arena representation. Final destruction happens when all the references (and the work) are gone.

## Constructor & Destructor Documentation

tbb::interface7::task_arena::task_arena | ( | int | max_concurrency_ = `automatic`,
|  | unsigned | reserved_for_masters = `1`
| ) |  |
| inline

Creates task_arena with certain concurrency limits.

Sets up settings only, real construction is deferred till the first method invocation

- max_concurrency specifies total number of slots in arena where threads work
- reserved_for_masters specifies number of slots to be used by master threads only. Value of 1 is default and reflects behavior of implicit arenas.

tbb::interface7::task_arena::~task_arena | ( | ) |  |
| inline

Removes the reference to the internal arena representation, and destroys the external object. Not thread safe wrt concurrent invocations of other methods.

## Member Function Documentation

static int tbb::interface7::task_arena::current_thread_index | ( | ) |  |
| inline static

Returns the index, aka slot number, of the calling thread in its current arena This method is deprecated and replaced with this_task_arena::current_thread_index()

void tbb::interface7::task_arena::debug_wait_until_empty | ( | ) |  |
| inline

Wait for all work in the arena to be completed Even submitted by other application threads Joins arena if/when possible (in the same way as execute())

template<typename F >

void tbb::interface7::task_arena::enqueue | ( | const F & | f) |  |
| inline

Enqueues a task into the arena to process a functor, and immediately returns. Does not require the calling thread to join the arena

template<typename F >

void tbb::interface7::task_arena::enqueue | ( | const F & | f,
|  | priority_t | p
| ) |  |
| inline

Enqueues a task with priority p into the arena to process a functor f, and immediately returns. Does not require the calling thread to join the arena

template<typename F >

void tbb::interface7::task_arena::execute | ( | F & | f) |  |
| inline

Joins the arena and executes a functor, then returns If not possible to join, wraps the functor into a task, enqueues it and waits for task completion Can decrement the arena demand for workers, causing a worker to leave and free a slot to the calling thread

template<typename F >

void tbb::interface7::task_arena::execute | ( | const F & | f) |  |
| inline

Joins the arena and executes a functor, then returns If not possible to join, wraps the functor into a task, enqueues it and waits for task completion Can decrement the arena demand for workers, causing a worker to leave and free a slot to the calling thread

bool tbb::interface7::task_arena::is_active | ( | ) |  | const
| inline

Returns true if the arena is active (initialized); false otherwise. The name was chosen to match a task_scheduler_init method with the same semantics.

void tbb::interface7::task_arena::terminate | ( | ) |  |
| inline

Removes the reference to the internal arena representation. Not thread safe wrt concurrent invocations of other methods.

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

- task_arena.h

Copyright © 2005-2017 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.