Piotr Barejko
Piotr Barejko

Reputation: 658

c++ two tbb::parallel_for loops efficiency

In my code I call parallel_for twice:

parallel_for( do some stuff ); // I want this operation to finish first
parallel_for( do some other stuff ); // then I want to do this

1) Does this approach create physical threads twice ? and makes it slower ?

2) If needed, what would be the best method to replace those two calls of parallel_for ?

Upvotes: 0

Views: 363

Answers (1)

Anton
Anton

Reputation: 6587

1) No, TBB has single shared pool of threads which are created lazily on demand. So lazily that completion of the first parallel_for does not guarantee creation of all the threads.

2) Not needed.

Upvotes: 3

Related Questions