What constitutes a data race in C++?
- A Two threads accessing the same memory concurrently where at least one writes, without synchronisation
- B Any use of two threads
- C Two threads reading the same variable
- D Threads finishing at different times
Answer
Two threads accessing the same memory concurrently where at least one writes, without synchronisation
A data race is undefined behaviour, not merely a wrong value, so the compiler may optimise on the assumption it cannot occur.





