summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llapr.cpp10
-rw-r--r--indra/llcommon/llapr.h1
-rw-r--r--indra/llcommon/lldate.h8
-rw-r--r--indra/llcommon/llerror.cpp65
-rw-r--r--indra/llcommon/llversionviewer.h2
5 files changed, 85 insertions, 1 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index 82530b1489..669afc5330 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -38,6 +38,7 @@
apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
apr_thread_mutex_t *gLogMutexp = NULL;
+apr_thread_mutex_t *gCallStacksLogMutexp = NULL;
const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool
@@ -51,6 +52,7 @@ void ll_init_apr()
// Initialize the logging mutex
apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
+ apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
}
if(!LLAPRFile::sAPRFilePoolp)
@@ -72,6 +74,14 @@ void ll_cleanup_apr()
apr_thread_mutex_destroy(gLogMutexp);
gLogMutexp = NULL;
}
+ if (gCallStacksLogMutexp)
+ {
+ // Clean up the logging mutex
+
+ // All other threads NEED to be done before we clean up APR, so this is okay.
+ apr_thread_mutex_destroy(gCallStacksLogMutexp);
+ gCallStacksLogMutexp = NULL;
+ }
if (gAPRPoolp)
{
apr_pool_destroy(gAPRPoolp);
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index 44ad2dd50f..63130a89fc 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -49,6 +49,7 @@
#include "llstring.h"
extern apr_thread_mutex_t* gLogMutexp;
+extern apr_thread_mutex_t* gCallStacksLogMutexp;
/**
* @brief initialize the common apr constructs -- apr itself, the
diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h
index 32825b18dc..7cc9c8aceb 100644
--- a/indra/llcommon/lldate.h
+++ b/indra/llcommon/lldate.h
@@ -140,6 +140,14 @@ public:
bool operator!=(const LLDate& rhs) const { return (*this < rhs) || (rhs < *this); }
bool operator==(const LLDate& rhs) const { return !(*this != rhs); }
+ /**
+ * @brief Compare to epoch UTC.
+ */
+
+ bool isNull() const { return mSecondsSinceEpoch == 0.0; }
+ bool notNull() const { return mSecondsSinceEpoch != 0.0; }
+
+
private:
F64 mSecondsSinceEpoch;
};
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index d671decccb..b135dafb3c 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1223,9 +1223,62 @@ namespace LLError
char** LLCallStacks::sBuffer = NULL ;
S32 LLCallStacks::sIndex = 0 ;
+ class CallStacksLogLock
+ {
+ public:
+ CallStacksLogLock();
+ ~CallStacksLogLock();
+ bool ok() const { return mOK; }
+ private:
+ bool mLocked;
+ bool mOK;
+ };
+
+ CallStacksLogLock::CallStacksLogLock()
+ : mLocked(false), mOK(false)
+ {
+ if (!gCallStacksLogMutexp)
+ {
+ mOK = true;
+ return;
+ }
+
+ const int MAX_RETRIES = 5;
+ for (int attempts = 0; attempts < MAX_RETRIES; ++attempts)
+ {
+ apr_status_t s = apr_thread_mutex_trylock(gCallStacksLogMutexp);
+ if (!APR_STATUS_IS_EBUSY(s))
+ {
+ mLocked = true;
+ mOK = true;
+ return;
+ }
+
+ ms_sleep(1);
+ }
+
+ // We're hosed, we can't get the mutex. Blah.
+ std::cerr << "CallStacksLogLock::CallStacksLogLock: failed to get mutex for log"
+ << std::endl;
+ }
+
+ CallStacksLogLock::~CallStacksLogLock()
+ {
+ if (mLocked)
+ {
+ apr_thread_mutex_unlock(gCallStacksLogMutexp);
+ }
+ }
+
//static
void LLCallStacks::push(const char* function, const int line)
{
+ CallStacksLogLock lock;
+ if (!lock.ok())
+ {
+ return;
+ }
+
if(!sBuffer)
{
sBuffer = new char*[512] ;
@@ -1261,6 +1314,12 @@ namespace LLError
//static
void LLCallStacks::end(std::ostringstream* _out)
{
+ CallStacksLogLock lock;
+ if (!lock.ok())
+ {
+ return;
+ }
+
if(!sBuffer)
{
sBuffer = new char*[512] ;
@@ -1283,6 +1342,12 @@ namespace LLError
//static
void LLCallStacks::print()
{
+ CallStacksLogLock lock;
+ if (!lock.ok())
+ {
+ return;
+ }
+
if(sIndex > 0)
{
llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ;
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 15f0e98330..a28d0f7268 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -35,7 +35,7 @@
const S32 LL_VERSION_MAJOR = 1;
const S32 LL_VERSION_MINOR = 24;
-const S32 LL_VERSION_PATCH = 0;
+const S32 LL_VERSION_PATCH = 2;
const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Second Life Release";