Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Zhongze_L_
Beginner
49 Views

creating threads

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
49 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