summaryrefslogtreecommitdiff
path: root/indra/llcommon/llthreadsafequeue.cpp
diff options
context:
space:
mode:
authorDebi King (Dessie) <dessie@lindenlab.com>2011-10-27 14:54:57 -0400
committerDebi King (Dessie) <dessie@lindenlab.com>2011-10-27 14:54:57 -0400
commit8c318d16393229044a401243a95fc8bb5e805c7f (patch)
tree56edab693a1977fb117eb7e2d85b60648898cee1 /indra/llcommon/llthreadsafequeue.cpp
parent1eda81eac813447cd357ac1972654ee9c1ec5506 (diff)
parente062be734ae421cc793a4c5e2e077a0c1d22262d (diff)
reconciled .hgtags
Diffstat (limited to 'indra/llcommon/llthreadsafequeue.cpp')
-rw-r--r--indra/llcommon/llthreadsafequeue.cpp15
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);
}