jeudi 31 mai 2018

Is writing std::deque at different memory locations concurrently thread-safe?

I have a std::deque<std::pair<CustomObj, int>> that doesn't change in size when starting the concurrent block.

The concurrent block reads each CustomObj of the deque and sets the int.

I can guarantee that the deque won't change size therefore it won't reallocate, and that each thread will only access a memory chunk of the deque but not the other thread's.

Does it lead to undefined behaviour reading and writing concurrently? Should put the writing and reading in a mutual exclusion zone?

Aucun commentaire:

Enregistrer un commentaire