Sorry to bring up the old subject (I did see the previous posts on the
subject) but I am still not sure about Interlocked class.
Especially since I saw somewhere that these APIs still require
MemoryBarrier usage?

What I am asking if for example the following pattern is correct with
respect to weak ordering CPUs
int disposeCounter = 0;
 protected virtual void Dispose(bool disposing) {
   if (Interlocked.Increment(disposeCounter) != 1)
      return;
  // Do the dispose stuff.
 }

--
NOTICE: If received in error, please destroy and notify sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.

Reply via email to