creating threads

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

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting - zhongzel@gmail.com
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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today