No test is needed. When two or more threads access the same memory location, and at least one of those threads is writing then proper synchronization is needed - otherwise you have unsynchronized access / data races. This is the case on the mentioned lines.

gg