Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2001-08-18 14:36:05


I apologize in advance if this has already been brought up...

In semaphore.html, up is described as:

    unsigned ct;
    bool ret;
    { // as a single atomic operation:
         ct = m_count;
         if (m_count == m_max) ret = false;
         else
         {
             ret = true;
             ++m_count;
         }
    }
    if (prev) *prev = m_count;
    return ret;

Should the final line be instead:

    if (prev) *prev = ct;

?

Otherwise it seems as if the ct variable has no use.

-Howard


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