title: How to implement double compare and swap in C/Linux?
body: <p>I was reading the paper <a href="http://dl.acm.org/citation.cfm?id=248106" rel="nofollow">"Simple, fast, and practical non-blocking and blocking concurrent queue algorithms"</a> and I realized that that they assume that the computer implements the following pseudo-code atomically:</p>
  
  <pre><code>CAS(Q-&gt;Tail,tail,&lt;next.ptr,next.count+1&gt;)
  </code></pre>
  
  <p>Where Q->Tail and tail are a pointer and an instance of a struct containing a pointer and a counter.</p>
  
  <p>I know that gcc provides a couple of build-ins for single word compare and swap in c. However, is it possible to implement a non-blocking atomic double compare and swap from a single compare and swap in c (using Linux)? Is this the right approach to implement the pseudo-code of the referenced paper?</p>