title: How to migrate from OSSpinLock to os_unfair_lock()?
body: <p>As of macOS 10.12, <code>OSSpinLock</code> has been deprecated. The XCode error messages urge me to use <code>os_unfair_lock_unlock()</code> instead. </p>
  
  <p>As a legacy of some open source stuff I'm relying on, I'm using RegexKitLite from 2010. </p>
  
  <p>How can I convert the spin lock type? Simple unlocking and locking I can manage, but these comparisons are giving me headache:</p>
  
  <pre class="lang-c prettyprint-override"><code>if(rkl_cacheSpinLock != (OSSpinLock)0) { ... }
  </code></pre>
  
  <p><code>rkl_cacheSpinLock</code> is of type <code>os_unfair_lock</code> and has been initialized. OSSpinLock seems to be of type <code>int</code>, so this if-statement obviously won't work.</p>
  
  <p>Could anyone point me towards the right way of approaching this? I'm not too familiar with C, and don't really understand arithmetics of pointers.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>After learning a bit about C, I came to understood typecasting. I came up with a solution that <em>seems</em> to work. My understanding of OS functionality on this level is nonexistent. The os_unfair_lock is not too well documented for dummies, but it looks like I didn't break anything.</p>
  
  <p><code>if (rkl_cacheSpinLock._os_unfair_lock_opaque != 0) { ... }</code></p>