Hacker News new | ask | show | jobs
by didibus 2524 days 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?

1 comments

By 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.