#include <task_arena.h>
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. | |
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 | 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 () |
Static Public Member Functions | |
static int | current_slot () |
Returns the index, aka slot number, of the calling thread in its current arena. | |
Friends | |
class | tbb::internal::task_scheduler_observer_v3 |
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.
|
inline |
Creates task_arena with certain concurrency limits.
Sets up settings only, real construction is deferred till the first method invocation
|
inline |
Removes the reference to the internal arena representation, and destroys the external object. Not thread safe wrt concurrent invocations of other methods.
|
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())
|
inline |
Enqueues a task into the arena to process a functor, and immediately returns. Does not require the calling thread to join the arena
|
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
|
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
|
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
|
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.
|
inline |
Removes the reference to the internal arena representation. Not thread safe wrt concurrent invocations of other methods.