title: How to implement a unmanaged thread-safe collection when I get this error: <mutex> is not supported when compiling with /clr
body: <p>I have a C++ application which consists of unmanaged C++, managed C++ and c#. In the unmanaged part I'm trying to create a thread safe collection using std::mutex. </p>
  
  <p>However when I use the mutex I get the following error;</p>
  
  <blockquote>
    <p>error C1189: #error :  &lt;mutex> is not supported when compiling with /clr or /clr:pure.</p>
  </blockquote>
  
  <p>Any idea why I can't use the mutex?
  Can someone recommend a replacement for it so that I can create a thread-safe unmanaged collection?</p>