diff options
author | Debi King (Dessie) <dessie@lindenlab.com> | 2011-10-16 08:36:54 -0400 |
---|---|---|
committer | Debi King (Dessie) <dessie@lindenlab.com> | 2011-10-16 08:36:54 -0400 |
commit | ed50235528e90747cbc2e558d73d6d93d56d188e (patch) | |
tree | 80f3ff1ed5753a1eacfb70279d39cbf850482f81 /indra/llcommon/llthreadsafequeue.cpp | |
parent | 0a4b187301e1d5521dda7d2f157a94f02d597365 (diff) | |
parent | 4ac1b64665a49c7121411f3db27718f0c37eaf33 (diff) |
reconciled .hgtags
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); } |