Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

creating threads

Zhongze_L_
Beginner
381 Views
Hello,

I would like to know if pthread_create is called each time when parallel_for or parallel_reduce is invoked.

Thanks,
Zhongze
0 Kudos
1 Reply
robert-reed
Valued Contributor II
381 Views
I would like to know if pthread_create is called each time when parallel_for or parallel_reduce is invoked.

Nope. By the time parallel_for or parallel_reduce are invoked, the threads for TBB's use should have already been created. When you create the first task_scheduler_init object (if not declared deferred), one of the initialization steps is to create the worker thread pool. On Linux and MacOS machines, that's when pthread_create will be called.
0 Kudos
Reply