The empty if statement is a bit suspect. I don't think CAS can fail so I'd add an assert in the if statement.