title: Linux equivalent to windows's EnterCriticalSection
body: <p>I couldn't find a definitive answer so this is the place.<br>
  Windows' <code>EnterCriticalSection</code> acts in the way that I can lock it multiple times in the same thread, and I need to unlock it on the way out the exact number of times so it will get free.  </p>
  
  <p>What is the Linux equivalent?
  Does pthread mutex acts in the same way? Or is it multiple locks, single unlock...</p>