• 2021.6
  • 04/11/2022
  • Public Content

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. The
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
function on all but the last one, then call
for the last instance.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.