Data race in thread
Data race in threading Hi I have a vector of structor.. this structure objects are created dynamically and pushed to vector.. I am planning this in main thread Once a entry is appended to vector of structure objects, one additional thread from a thread pool is assigned a task which need to read data from vector of structure objects. As it is reading of data from vector for a thread pool threads, i just dont need to use mutex or semaphore... Correct ?? I understand that vector might allocate data again and again at new location when capacity reaches size for any push operation. This might cause the data race and hence I am setting capacity as well in advance with reserving space for 2 million data... i am sure my implementation is never gonna push more than these many objects... With this , do i need to take care of anything else to avoid data race ? Thanks for your suggestions well in advance... feel free to share different view and dont hesitate to ask for any query in case you have some