Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I don't understand why this comment has been marked down, can anyone explain? Seems reasonable to me Commented Nov 26, 2010 at 15:11
  • @Mark 909: Because it's incorrect as explained in my comment. Just because the update is atomic doesn't mean the lock (or some other memory barrier) isn't required. Commented Nov 26, 2010 at 15:24
  • 2
    More specifically, if _status isn't marked volatile, other threads might not see the change in value right away. I had assumed it was already volatile when I wrote my answer, which is not the most brilliant assumption I've made. Anyway, it appears that volatile may not even accomplish what it's documented to, as per Jon Skeet's answer. Commented Nov 26, 2010 at 16:59