|
|
|
|
|
by Thorrez
1583 days ago
|
|
As reitzensteinm points out, even if every thread does "x = x + 1", x can decrease. x starts as 0. Thread A evaluates x + 1, getting 1. Thread B executes the full statement 100 times, setting x to 100. Thread A finishes executing the statement, setting x to 1. So x decreased from 100 to 1. But I agree with you that this is a race condition, not a data race. |
|