
31 Oct
2006
31 Oct
'06
4:26 a.m.
the decrement predicates
bool try_dec() throw() { intword_t local; do { local = m_count.load(mb::naked);
if (! local || local < 1) { return false; }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// use mb::fence to cover *both acquire and release // wrt the result of the decrement } while(! m_count.cas(local, local - 1, mb::fence)); return (local == 1); }
could all look like this: if (local < 1) { return false; } I made a redundant assertion...