Do we need locking if we are appending and reading data from vector simultaneously?(no-modification)

  append, c++, locking, push, vector

We know that if more than one thread operates on an object and there is a modification involved, we need some kind of locking(atomic/mutex). For my case only these operations are happening simultaneously for a std::vector:

1. Read
2. Append/Push

Will the vector need a lock in this case? and if yes, why? My program is based on CPP.

I’m new to the lock concept. Any hint in the right direction will work for me.

Source: Windows Questions C++

LEAVE A COMMENT