Let's say I have an object threadWork
initialised as:
vector< vector<myType> > threadWork(N_THREADS, vector<myType>());
I then deploy N_THREADS
threads, each performing writes via vector::push_back()
s to a separate element (its own vector<myType>
object) of threadWork
.
One thread then calls vector::clear()
on its element of threadWork
.
Does this invalidate the writes of the other threads to their element?
i.e Can vector::clear()
called on one element of threadWork
alter
the memory allocation of the other elements of threadWork
,
such that a thread may be writing to invalid addresses as a result?