title: Interlocked used to increment/mimick a boolean, is this safe?
body: <p>I'm just wondering whether this code that a fellow developer (who has since left) is OK, I think he wanted to avoid putting a lock. Is there a performance difference between this and just using a straight forward lock?</p>
  
  <pre><code>    private long m_LayoutSuspended = 0;
      public void SuspendLayout()
      {
          Interlocked.Exchange(ref m_LayoutSuspended, 1);
      }
  
      public void ResumeLayout()
      {
          Interlocked.Exchange(ref m_LayoutSuspended, 0);
      }
  
      public bool IsLayoutSuspended
      {
          get { return Interlocked.Read(ref m_LayoutSuspended) != 1; }
      }
  </code></pre>
  
  <p>I was thinking that something like that would be easier with a lock? It will indeed be used by multiple threads, hence why the use of locking/interlocked was decided.</p>