summaryrefslogtreecommitdiff
path: root/indra/llcommon/llapr.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-12-02 14:57:29 -0800
committerRichard Linden <none@none>2013-12-02 14:57:29 -0800
commit34ff2fc46ba8c623f0eab8fe1dccb5db327775a8 (patch)
tree7bc422dd969e1d18e9d83e52a9a6dcfa2bd6139f /indra/llcommon/llapr.cpp
parent787ccaf297e81291469aaf269f563d862fb150a3 (diff)
parentd8e92867162f8c4ff9489d8eefde53546e907dff (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;
}