Thread Data Race
Hi I have a thread pool which has 12 threads. I have a function which is used as a thread function for all these twelve threads. Last argument is output parameter which gets filled by thread function. Thread function is something as below: void myFunc(int a,int b,int c,vector<int>& out); out vector is filled by this function. vector<thread> vThreads; vThreads.resize(12); vector<vector<int>> resVals(12); for (int iCurThread = 0; iCurThread < intThreadCnt; ++iCurThread) { vThreads.at(iCurThread) = thread(&myFunc,1,2,3, ref(resVals[iCurThread])); } for (std::thread& active_thread : vThreads) { active_thread.join(); } Is it right that there is no data race in this case even though I have not used mutex? I think no data race as each thread is modifying specific vector from vector of vector. Right?