[cpp-threads] modes, pass 2

Ben Hutchings ben at decadentplace.org.uk
Sun May 8 18:29:45 BST 2005


Peter Dimov wrote:
> Doug Lea wrote:
> >> I don't understand fallible_*,
> >
> > It means that CAS can return false just because it feels like it.
> > Like LL/SC does on all platforms I know that use it.
> 
> If an implementation gives me fallible CAS when I ask for infallible CAS, 
> how can I tell? And even if I could tell, why would I want to?
<snip>

If normal CAS fails you know that the value it read was not the expected
value.  In this case you might not want to retry.  If "fallible CAS"
based on LL/SC fails, you don't know that.  (However, CAS normally
yields the current value from memory even if it fails, and LL/SC
obviously does, so perhaps compare_and_set_* could return this value
instead of a boolean.  Are there implementations that don't provide that
information?)

Ben.

-- 
Ben Hutchings
compatible: Gracefully accepts erroneous data from any source




More information about the cpp-threads mailing list