Description
Using task_scheduler_init is optional in Intel® TBB 2.2. By default, Intel® TBB 2.2
automatically creates a task scheduler the first time that a thread uses task
scheduling services and destroys it when the last such thread exits.
An instance of task_scheduler_init can be used to control the following aspects of
the task scheduler:
• When the task scheduler is constructed and destroyed.
• The number of threads used by the task scheduler.
• The stack size for worker threads.
To override the automatic defaults for task scheduling, a task_scheduler_init must
become active before the first use of task scheduling services.
A task_scheduler_init is either "active" or "inactive".
The default constructor for a task_scheduler_init activates it, and the destructor
deactivates it. To defer activation, pass the value task_scheduler_init::deferred
to the constructor. Such a task_scheduler_init may be activated later by calling
method initialize. Destruction of an active task_scheduler_init implicitly
deactivates it. To deactivate it earlier, call method terminate.
An optional parameter to the constructor and method initialize allow 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.
Partager