Atomically compare 'old_val' to 'value_' and set 'value_' to 'new_val' and return true if they compared equal, otherwise return false (and do no updates), with "barrier" memory-ordering semantic. That is, atomically performs: if (value_ == old_val) { value_ = new_val; return true; } return false;
| 102 | /// } |
| 103 | /// return false; |
| 104 | ALWAYS_INLINE bool CompareAndSwap(T old_val, T new_val) { |
| 105 | return base::subtle::Barrier_CompareAndSwap(&value_, old_val, new_val) == old_val; |
| 106 | } |
| 107 | |
| 108 | /// Store 'new_val' and return the previous value. Implies a Release memory barrier |
| 109 | /// (i.e. the same as Store()). |