That seemes rather wasteful: I want to check this in a function which can be called from different threads. The function is part of a video tracking system, so it can be called millions of times. If I have to add a task_scheduler_init instance for every call...
Thank for your answer, it is most helpful. The behavior of the constructor was not clear to me from the documentation.
I need the task_scheduler_init class to use parallel_reduce. It makes a loop that evaluates the particles in a particle filter parallel. The loop was a performance bottleneck found with a profiler.