I plan to have 2 threads.
Thread 1 will only push back new items into the vector.
Thread 2 will only get item of the vector by index, namely v[i].
Is this thread safe?
If this is not, is there any better solution? What I want is not to block thread 1, i.e. the push back. It's ok to have a short sleep or block or delay for thread 2 to get information from the vector.
Edit: The answer is no, and probably a fixed size array will be a solution.