Пример #1
0
    void ObjectPool::putReallocBuffer(ReallocBuffer * pRb)
    {
        std::auto_ptr<ReallocBuffer> rbPtr(pRb);

        pRb->resize(0);
        Lock lock(mRbPoolMutex);
        if (mRbPool.size() < mBufferCountLimit)
        {
            mRbPool.push_back(rbPtr.release());
        }
    }
Пример #2
0
    void ObjectPool::putReallocBuffer(ReallocBuffer * pRb)
    {
        std::auto_ptr<ReallocBuffer> rbPtr(pRb);
        std::size_t bufferSize = rbPtr->capacity();
        pRb->resize(0);

        // Check buffer count limit and buffer size limit.
        Lock lock(mRbPoolMutex);
        if (mRbPool.size() < mBufferCountLimit && bufferSize <= mBufferSizeLimit)
        {
            mRbPool.push_back(rbPtr.release());
        }
    }