# tbb::interface6::task_arena Class Reference

`#include <task_arena.h>`

List of all members.

## Public Member Functions
| task_arena (int max_concurrency=automatic)
| Creates task_arena with certain concurrency limit.
| task_arena (const task_arena &s)
| Copies settings from another task_arena.
| ~task_arena ()
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 | wait_until_empty ()
void | initialize (int max_concurrency)
| Sets concurrency level and initializes internal representation.
## Static Public Member Functions
static int __TBB_EXPORTED_FUNC | current_slot ()
| Returns the index, aka slot number, of the calling thread in its current arena.
## Static Public Attributes
static const int | automatic = -1
| Typedef for number of threads that is automatic.
## Friends
class | internal::task_scheduler_observer_v3

## 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 TODO: A side effect of this is that it's impossible to create a const task_arena object. Rethink? 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::interface6::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

template<typename F >

void tbb::interface6::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

References tbb::task::allocate_root().

template<typename F >

void tbb::interface6::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

References tbb::task::allocate_root().

template<typename F >

void tbb::interface6::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

template<typename F >

void tbb::interface6::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

void tbb::interface6::task_arena::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())

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

- task_arena.h

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