You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Nicole Willson <wi...@roguewave.com> on 2006/07/25 19:15:04 UTC

RE: problem in temp_buffer

I'm tracking down an issue with temp_buffer in stdlib/utilities.  I'm
confused by a piece of code in source/stdlib/tmpbuf.cpp:
 
if (nbytes <= _RWSTD_TMPBUF_SIZE) {
 
        if (1 == _RWSTD_THREAD_PREINCREMENT (__rw_buffer_busy, false)) {
 
            *pptr = buffer;
 
            // static buffer used, its usage counter stays non-zero
            return _RWSTD_TMPBUF_SIZE / size;
        }
 
        // static buffer not used, decrement its usage counter
        _RWSTD_THREAD_PREDECREMENT (__rw_buffer_busy, false);
    }
 
    _TRY {
        *pptr = __rw_allocate (nbytes, 0);
    }
    _CATCH (...) {
        *pptr  = 0;
        nbytes = 0;
    }
 
    return nbytes / size;

 
What is the purpose of the check against _RWSTD_TMPBUF_SIZE if it is
ignored?

Nicole Willson

Consulting Engineer

Rogue Wave Software, Inc.

A Division of Quovadx

303-545-3210