diff options
author | Oz Linden <oz@lindenlab.com> | 2011-10-17 16:19:57 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-10-17 16:19:57 -0400 |
commit | 77dc594e79118769087c0e2094c303fc5aaea5d4 (patch) | |
tree | ed538b0b4e1d0b1de7ecbf22f701bbb1595b967c /indra/llcommon/llthreadsafequeue.cpp | |
parent | 94c137d5c970bc01e3a4dbe8de6a7104085e5ba6 (diff) | |
parent | 1afbdc79c6fb911a5ab2c87067e7b99bec92fbc6 (diff) |
merge back late changes and tags from release branch
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); } |