I want to push_back an object into a vector from different threads. The no. of threads depends on the machine.
#pragma omp parallel shared(Spaces, LookUpTable) private(LutDistribution, tid)
{
tid = omp_get_thread_num();
BestCoreSpaces.push_back( computeBestCoreSpace(tid, &Spaces, &LookUpTable, LutDistribution));
}
The problem is, that I'm not sure if it's working. I don't get crashes. I'm using openMP. Is openMP queuing something? Maybe its enough to reserve memory for the container with BestCoreSpaces.reserve(tid) or to assign the amount of elements with BestCoreSpaces.assign(tid, Space). Can somebody help me?