Boost logo

Boost :

From: Chris Thomasson (cristom_at_[hidden])
Date: 2006-10-30 23:26:26


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...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk