Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

creating threads

Zhongze_L_
Beginner
124 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
124 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.
Reply