3 ms·
Hum... okay. Maybe I'm not understanding what is meant by a data race here. So your example would be: function f() { lastTime = Time.now(); } And now
by didibus 7y ago
Hum... okay. Maybe I'm not understanding what is meant by a data race here.
So your example would be:
function f() {
lastTime = Time.now();
}
And now if we had threads T1 and T2 calling f concurrently, you say this would be a data race?
So I'm confused here. There's no bug, so a data race is not a category of defect the way race conditions are? Both your example and the article's example was a data race that is not a bug. Is there an example of a data race that is not a race condition yet leads to a bug?
- czrnb 7y agoBy the article's definition, yes, it would be a data race. With this example, I just wanted to make it more explicit to you what a data race without a race condition could look like. Truly I'm still not sure why the author had to make a point and write a blog post about the conceptual difference between data races and race conditions.