title: Using Interlocked.CompareExchange() operation on a bool value?
body: <p>I have two questions:</p>
  <ol>
  <li><p>Is there a need to use Interlocked class for accessing boolean values? Isn't a read or a write to a boolean value atomic by default?</p>
  </li>
  <li><p>I tried using Interlocked.CompareExchange on a boolean and got the following error:</p>
  <pre><code> bool value = true;
   Interlocked.CompareExchange&lt;bool&gt;(ref value, false, true);
  </code></pre>
  <p>Error: The type 'bool' must be a reference type in order to use it as parameter 'T' in the generic type or method 'System.Threading.Interlocked.CompareExchange(ref T, T, T)'</p>
  </li>
  </ol>
  <p>How do I go about solving this problem?</p>