title: Thread-safe deletion of a linked list node, using the fine-grained approach
body: <p>Why is the following snippet for deleting a node in a linked list not thread safe?</p>
  
  <p>edit: note every node has a lock of its own</p>
  
  <pre><code>// ... lock acquisition here
  // ... assumption found to be valid here
  prev-&gt;next = p-&gt;next;
  p-&gt;next = NULL;
  p-&gt;deleted = 1;
  </code></pre>