Boost logo

Boost :

From: Adrian (jarfo_at_[hidden])
Date: 2004-03-16 04:43:16


Dear William

I think you have missed pthread_mutexattr_destroy() in
recursive_mutex::recursive_mutex() and
recursive_mutex::recursive_try_mutex().

Proposed patch:

#elif defined(BOOST_HAS_PTHREADS)
recursive_mutex::recursive_mutex()
    : m_count(0)
# if !defined(BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE)
    , m_valid_id(false)
# endif
{
    pthread_mutexattr_t attr = 0;
    int res = 0;
    res = pthread_mutexattr_init(&attr);
    assert(res == 0);

# if defined(BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE)
    res = pthread_mutexattr_settype(&attr,
PTHREAD_MUTEX_RECURSIVE);
    assert(res == 0);
# endif

    res = pthread_mutex_init(&m_mutex, &attr);
    pthread_mutexattr_destroy(&attr); /* missing */
        if (res != 0)
        throw thread_resource_error();
../..

recursive_try_mutex::recursive_try_mutex()
    : m_count(0)
# if !defined(BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE)
    , m_valid_id(false)
# endif
{
    pthread_mutexattr_t attr = 0;
    int res = 0;
    res = pthread_mutexattr_init(&attr);
    assert(res == 0);

# if defined(BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE)
    res = pthread_mutexattr_settype(&attr,
PTHREAD_MUTEX_RECURSIVE);
    assert(res == 0);
# endif

    res = pthread_mutex_init(&m_mutex, &attr);
    pthread_mutexattr_destroy(&attr);
    if (res != 0)
        throw thread_resource_error();

___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es


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