Does concurrent wringing the same value to the primitive variable needs to be synchronized?
bool updated_flag = false; // indicates that the data was updated /* Any thread which modifies the data must set updated_flag = true */ /* Later, after reaching the serial section, check the value of updated_flag. updated_flag == true indicates, that the data was modified. */
Either all threads write the same value into updated_flag or all threads leave updated_flag unchanged. I could replace updated_flag with an atomic variable, but don't want to do it unless there is a need.