O'Reilly logo
  • Fernando Chapa thinks this is interesting:

But a similar issue lurks with loads of the fields. Because all of the processors mentioned above, in addition to the .NET memory model, allow load-to-load reordering in some circumstances, the load of m_value could move after the load of the object’s fields. The effect would be similar and marking m_value as volatile prevents it. Marking the object’s fields as volatile is not necessary because the read of the value is an acquire fence and prevents the subsequent loads from moving before, no matter whether they are volatile or not. This might seem ridiculous to some: how could a field be read before a reference to the object itself? This appears to viola...


Cover of Concurrent Programming on Windows


See discussion: