Name

task_scheduler_init Class — Class that represents thread’s interest in task scheduling services.

Synopsis

#include "tbb/task_soinit;

Description

A task_scheduler_init is either active or inactive. Each thread that uses a task should have one active task_scheduler_init object that stays active over the duration that the thread uses task objects. A thread may have more than one active task_scheduler_init at any given moment.

The default constructor for a task_scheduler_init activates it, and the destructor deactivates it. To defer initialization, pass the value task_scheduler_init::deferred to the constructor. Such a task_scheduler_init may be initialized later by calling the initialize method. Destruction of an initialized task_scheduler_init implicitly deactivates it. To deactivate it earlier, call the terminate method.

An optional parameter to the constructor and initialize method allows you to specify the number of threads to be used for task execution. This parameter is useful for scaling studies during development, but should not be set for production use.

To minimize time overhead, it is best to have a thread create a single task_scheduler_init object whose activation spans all uses of the library’s task scheduler. A task_scheduler_ init is not assignable or copy-constructible.

Warning

The template algorithms implicitly use the task class. Hence, creating a task_scheduler_init object is a prerequisite to using the template algorithms. The debug version of the library will report ...

Get Intel Threading Building Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.