[cpp-threads] Failed compare-and-swap

Bill Pugh pugh at cs.umd.edu
Wed Aug 1 04:28:36 BST 2007


I cast my vote for saying that a failed compare and swap or failed  
trylock should have no synchronization semantics.

The only idioms I know of that would depend on failed atomic  
operations having synchronization semantics are so problematical that  
we should do everything we can to discourage people from trying to  
use them.

By giving fail operations semantics, you also rule out possible  
implementation strategies that might be advantageous in some current  
or future platform.

Bill Pugh




More information about the cpp-threads mailing list