Showing results for 
Search instead for 
Did you mean: 

Advice: concurrent_vector static?

Dear all,

my application is quite simple: I need several working threads compute solutions independently, and if valid add them to a container.

I've thought of using a concurrent_vector for the solutions, and either pass the vector as a reference, or make the results a static vector inside the builder class.

Another option I've thought about is having each thread a separate solution vector, and use a parallel_reduce. However, I think this solution will take more time than a concurrent vector.

This is an important information: the probability of finding a valid solution is low, so I don't think I would hit several threads accessing the solution container at the same time.

I am open to any suggestions, since this is the first time I'm using TBB.



0 Kudos
0 Replies