summaryrefslogtreecommitdiff
path: root/indra/llcommon/llapr.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2014-03-24 19:23:34 -0700
committerRichard Linden <none@none>2014-03-24 19:23:34 -0700
commite5bbdafdeda0f2e6bbe97d59a24ca398b54c31eb (patch)
tree359719c76abf090fb8cc5ae912ed013b64cb8fc7 /indra/llcommon/llapr.cpp
parent31a3a3da5db077c4d9b8fe06a18de98c822db6ab (diff)
parent5b846ed2a6dce6c5801aa74d0f36a1c7525fbcba (diff)
merge with release
Diffstat (limited to 'indra/llcommon/llapr.cpp')
-rwxr-xr-xindra/llcommon/llapr.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index b7815b0e35..a548c96002 100755
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -29,6 +29,7 @@
#include "linden_common.h"
#include "llapr.h"
#include "apr_dso.h"
+#include "llthreadlocalstorage.h"
apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
@@ -37,12 +38,15 @@ apr_thread_mutex_t *gCallStacksLogMutexp = NULL;
const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool
+bool gAPRInitialized = false;
+
void ll_init_apr()
{
+ // Initialize APR and create the global pool
+ apr_initialize();
+
if (!gAPRPoolp)
{
- // Initialize APR and create the global pool
- apr_initialize();
apr_pool_create(&gAPRPoolp, NULL);
// Initialize the logging mutex
@@ -54,11 +58,21 @@ void ll_init_apr()
{
LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ;
}
+
+ LLThreadLocalPointerBase::initAllThreadLocalStorage();
+ gAPRInitialized = true;
}
+bool ll_apr_is_initialized()
+{
+ return gAPRInitialized;
+}
+
void ll_cleanup_apr()
{
+ gAPRInitialized = false;
+
LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL;
if (gLogMutexp)
@@ -77,6 +91,9 @@ void ll_cleanup_apr()
apr_thread_mutex_destroy(gCallStacksLogMutexp);
gCallStacksLogMutexp = NULL;
}
+
+ LLThreadLocalPointerBase::destroyAllThreadLocalStorage();
+
if (gAPRPoolp)
{
apr_pool_destroy(gAPRPoolp);
@@ -429,7 +446,7 @@ S32 LLAPRFile::read(void *buf, S32 nbytes)
{
if(!mFile)
{
- llwarns << "apr mFile is removed by somebody else. Can not read." << llendl ;
+ LL_WARNS() << "apr mFile is removed by somebody else. Can not read." << LL_ENDL ;
return 0;
}
@@ -451,7 +468,7 @@ S32 LLAPRFile::write(const void *buf, S32 nbytes)
{
if(!mFile)
{
- llwarns << "apr mFile is removed by somebody else. Can not write." << llendl ;
+ LL_WARNS() << "apr mFile is removed by somebody else. Can not write." << LL_ENDL ;
return 0;
}