spouliot/gendarme — Issue #1: DoubleCheckLockingRule and MemoryBarrier (instead of volatile field)
Author: knocte
Created: 2012-01-18 13:28:37+00:00
State: open

DoubleCheckLockingRule proposes the use of the volatile keyword when using .NET >= 2.0.

This is right but according to http://blogs.msdn.com/b/brada/archive/2004/05/12/130935.aspx using a MemoryBarrier is a better solution.

So we need to, either mention this in the rule documentation, or change the rule so it proposes this as the good example. Or maybe have another rule in the Performance rules set that checks for this (since using volatile is actually correct wrt Concurrency, but less performant).