diff options
author | Richard@Callum-HP-PC.lindenlab.com <Richard@Callum-HP-PC.lindenlab.com> | 2011-10-21 14:41:24 -0700 |
---|---|---|
committer | Richard@Callum-HP-PC.lindenlab.com <Richard@Callum-HP-PC.lindenlab.com> | 2011-10-21 14:41:24 -0700 |
commit | f5197b6158bf1b9350fab2dd7877f6c0a4c2f778 (patch) | |
tree | ff9c621341b9076fff8a11b66befa6e37183f286 /indra/llcommon/llthreadsafequeue.cpp | |
parent | f2952ded0396e98e1010ebe39de5bba0ae6ba5f7 (diff) | |
parent | 255eebf11615a1a8c47003ee24b1696b8ae63e23 (diff) |
merge with viewer-dev
Diffstat (limited to 'indra/llcommon/llthreadsafequeue.cpp')
-rw-r--r-- | indra/llcommon/llthreadsafequeue.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp index 05d24944f3..8a73e632a9 100644 --- a/indra/llcommon/llthreadsafequeue.cpp +++ b/indra/llcommon/llthreadsafequeue.cpp @@ -34,11 +34,19 @@ //----------------------------------------------------------------------------- -LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(unsigned int capacity): +LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity): + mOwnsPool(pool == 0), + mPool(pool), mQueue(0) { - mPool.create(); - apr_status_t status = apr_queue_create(&mQueue, capacity, mPool()); + if(mOwnsPool) { + apr_status_t status = apr_pool_create(&mPool, 0); + if(status != APR_SUCCESS) throw LLThreadSafeQueueError("failed to allocate pool"); + } else { + ; // No op. + } + + apr_status_t status = apr_queue_create(&mQueue, capacity, mPool); if(status != APR_SUCCESS) throw LLThreadSafeQueueError("failed to allocate queue"); } @@ -51,6 +59,7 @@ LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation() " elements;" << "memory will be leaked" << LL_ENDL; apr_queue_term(mQueue); } + if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool); } |