race condition
A bug where the result depends on which thread happens to get there first.
A race condition occurs when correctness depends on the timing of unsynchronized accesses to shared state, at least one of them a write.
Loading interactive…
Examples
Two threads each running
count++1,000 times can finish below 2,000, because each++is a read, an add and a write.
See also