The need for fallback paths
Often programmers starting with Intel transactional Synchronization Extensions (TSX) don't fully appreciate that TSX transactions are best effort and always need a fallback path. So you cannot just use _xbegin() as a "super CMPXCHG". TSX always needs fallback code that guarantees progress without using transactions, otherwise the code may fail to make progress. Just putting a retry loop around the transaction is not enough.