But your &quot;write&quot; action is separate from the &quot;X.currlock&quot; operations, right?<p>Doesn&#x27;t it mean that this can happen?<p><pre><code>    A: X.currlock = Token_ID_A
    A: resource read
    A: is X.currlock still Token_ID_A? yes
    B: X.currlock = Token_ID_B
    B: resource read
    B: is X.currlock still Token_ID_B? yes
    B: resource write
    A: resource write
</code></pre>
Is there anything that makes the &quot;write-if-currlock == token&quot; operation atomic?