Intel® oneAPI Threading Building Blocks (oneTBB) Documentation
Initializing and Terminating the Library
oneAPI Threading Building Blocks (oneTBB) automatically initializes the task scheduler.
The initialization process is involved when a thread uses task scheduling services the first time,
for example any parallel algorithm, flow graph or task group.
The termination happens when the last such thread exits.
Explicit Library Finalization
oneTBB supports an explicit library termination as a preview feature.
function called with an instance of class
blocks the calling thread
until all worker threads implicitly created by the library have completed.
If waiting for thread completion is not safe, e.g. may result in a deadlock
or called inside a task, a parallel algorithm, or a flow graph node, the method fails.
If you know how many active
instances exist in the program,
it is recommended to call