From adeeabfc13c91dc99a1ea1949cd2f820c4150995 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 24 Sep 2012 18:56:01 -0700 Subject: SH-3275 WIP Run viewer metrics for object update messages moved LLThreadLocalPtr to llapr fixed various startup race conditions for LLThreadLocalPtr --- indra/llcommon/llapr.h | 117 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index af33ce666f..eb0bf627a0 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -49,6 +49,7 @@ #include "apr_signal.h" #include "apr_atomic.h" #include "llstring.h" +#include "llinstancetracker.h" extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp; extern apr_thread_mutex_t* gCallStacksLogMutexp; @@ -255,6 +256,122 @@ public: //******************************************************************************************************************************* }; +class LLThreadLocalPtrBase : LLInstanceTracker +{ +public: + LLThreadLocalPtrBase(void (*cleanup_func)(void*) ); + LLThreadLocalPtrBase(const LLThreadLocalPtrBase& other); + ~LLThreadLocalPtrBase(); + +protected: + friend void LL_COMMON_API ll_init_apr(); + void set(void* value); + + LL_FORCE_INLINE void* get() + { + void* ptr; + //apr_status_t result = + apr_threadkey_private_get(&ptr, mThreadKey); + //if (result != APR_SUCCESS) + //{ + // ll_apr_warn_status(s); + // llerrs << "Failed to get thread local data" << llendl; + //} + return ptr; + } + + LL_FORCE_INLINE const void* get() const + { + void* ptr; + //apr_status_t result = + apr_threadkey_private_get(&ptr, mThreadKey); + //if (result != APR_SUCCESS) + //{ + // ll_apr_warn_status(s); + // llerrs << "Failed to get thread local data" << llendl; + //} + return ptr; + } + + void initStorage(); + + void destroyStorage(); + + static void initAllThreadLocalStorage(); + +private: + void (*mCleanupFunc)(void*); + apr_threadkey_t* mThreadKey; + static bool sInitialized; +}; + +template +class LLThreadLocalPtr : public LLThreadLocalPtrBase +{ +public: + + LLThreadLocalPtr() + : LLThreadLocalPtrBase(&cleanup) + {} + + LLThreadLocalPtr(T* value) + : LLThreadLocalPtrBase(&cleanup) + { + set(value); + } + + + LLThreadLocalPtr(const LLThreadLocalPtr& other) + : LLThreadLocalPtrBase(other, &cleanup) + { + set(other.get()); + } + + T* get() + { + return (T*)LLThreadLocalPtrBase::get(); + } + + const T* get() const + { + return (const T*)LLThreadLocalPtrBase::get(); + } + + T* operator -> () + { + return (T*)get(); + } + + const T* operator -> () const + { + return (T*)get(); + } + + T& operator*() + { + return *(T*)get(); + } + + const T& operator*() const + { + return *(T*)get(); + } + + LLThreadLocalPtr& operator = (T* value) + { + set((void*)value); + return *this; + } + +private: + + static void cleanup(void* ptr) + { + delete reinterpret_cast(ptr); + } + +}; + /** * @brief Function which appropriately logs error or remains quiet on * APR_SUCCESS. -- cgit v1.2.3 From 05a3203d8274a0a0999faad128f629614b8d62c5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 26 Sep 2012 17:04:57 -0700 Subject: SH-3275 WIP Run viewer metrics for object update messages fixed various issues related to unit tests and LLThreadLocalPtr initialization and teardown --- indra/llcommon/llapr.h | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index eb0bf627a0..830e0a33fa 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -259,16 +259,19 @@ public: class LLThreadLocalPtrBase : LLInstanceTracker { public: - LLThreadLocalPtrBase(void (*cleanup_func)(void*) ); + LLThreadLocalPtrBase(); LLThreadLocalPtrBase(const LLThreadLocalPtrBase& other); ~LLThreadLocalPtrBase(); + static void initAllThreadLocalStorage(); + static void destroyAllThreadLocalStorage(); + protected: - friend void LL_COMMON_API ll_init_apr(); void set(void* value); LL_FORCE_INLINE void* get() { + llassert(sInitialized); void* ptr; //apr_status_t result = apr_threadkey_private_get(&ptr, mThreadKey); @@ -294,13 +297,9 @@ protected: } void initStorage(); - void destroyStorage(); - static void initAllThreadLocalStorage(); - -private: - void (*mCleanupFunc)(void*); +protected: apr_threadkey_t* mThreadKey; static bool sInitialized; }; @@ -311,10 +310,10 @@ class LLThreadLocalPtr : public LLThreadLocalPtrBase public: LLThreadLocalPtr() - : LLThreadLocalPtrBase(&cleanup) + : LLThreadLocalPtrBase() {} - LLThreadLocalPtr(T* value) + explicit LLThreadLocalPtr(T* value) : LLThreadLocalPtrBase(&cleanup) { set(value); @@ -327,7 +326,7 @@ public: set(other.get()); } - T* get() + LL_FORCE_INLINE T* get() { return (T*)LLThreadLocalPtrBase::get(); } @@ -363,13 +362,11 @@ public: return *this; } -private: - - static void cleanup(void* ptr) + bool operator ==(T* other) { - delete reinterpret_cast(ptr); + if (!sInitialized) return false; + return get() == other; } - }; /** -- cgit v1.2.3 From b1baf982b1bd41a150233d0a28d3601226924c65 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 30 Sep 2012 10:41:29 -0700 Subject: SH-3275 WIP Run viewer metrics for object update messages factored out lltrace::sampler into separate file added rudimentary lltrace support to llstatgraph made llstatgraph use param blocks more effectively moves initial set of stats over to lltrace removed windows.h #defines for min and max --- indra/llcommon/llapr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 830e0a33fa..4e704998c2 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -39,6 +39,8 @@ #define WIN32_LEAN_AND_MEAN #include #include + #undef min + #undef max #endif #include -- cgit v1.2.3 From 14b1b0b2bb6bac5bc688cc4d14c33f1b680dd3b4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 1 Oct 2012 19:39:04 -0700 Subject: SH-3275 WIP Run viewer metrics for object update messages cleaned up API samplers are now value types with copy-on-write buffers under the hood removed coupling with LLThread --- indra/llcommon/llapr.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 4e704998c2..6efb44a663 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -258,12 +258,12 @@ public: //******************************************************************************************************************************* }; -class LLThreadLocalPtrBase : LLInstanceTracker +class LLThreadLocalPointerBase : LLInstanceTracker { public: - LLThreadLocalPtrBase(); - LLThreadLocalPtrBase(const LLThreadLocalPtrBase& other); - ~LLThreadLocalPtrBase(); + LLThreadLocalPointerBase(); + LLThreadLocalPointerBase(const LLThreadLocalPointerBase& other); + ~LLThreadLocalPointerBase(); static void initAllThreadLocalStorage(); static void destroyAllThreadLocalStorage(); @@ -307,35 +307,35 @@ protected: }; template -class LLThreadLocalPtr : public LLThreadLocalPtrBase +class LLThreadLocalPointer : public LLThreadLocalPointerBase { public: - LLThreadLocalPtr() - : LLThreadLocalPtrBase() + LLThreadLocalPointer() + : LLThreadLocalPointerBase() {} - explicit LLThreadLocalPtr(T* value) - : LLThreadLocalPtrBase(&cleanup) + explicit LLThreadLocalPointer(T* value) + : LLThreadLocalPointerBase(&cleanup) { set(value); } - LLThreadLocalPtr(const LLThreadLocalPtr& other) - : LLThreadLocalPtrBase(other, &cleanup) + LLThreadLocalPointer(const LLThreadLocalPointer& other) + : LLThreadLocalPointerBase(other, &cleanup) { set(other.get()); } LL_FORCE_INLINE T* get() { - return (T*)LLThreadLocalPtrBase::get(); + return (T*)LLThreadLocalPointerBase::get(); } const T* get() const { - return (const T*)LLThreadLocalPtrBase::get(); + return (const T*)LLThreadLocalPointerBase::get(); } T* operator -> () @@ -358,7 +358,7 @@ public: return *(T*)get(); } - LLThreadLocalPtr& operator = (T* value) + LLThreadLocalPointer& operator = (T* value) { set((void*)value); return *this; -- cgit v1.2.3 From dbe9742703cf14db85ec3d16c540efc68dce95a6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 2 Oct 2012 15:37:16 -0700 Subject: SH-3404 create sampler class renamed LLTrace::ThreadTrace to LLTrace::ThreadRecorder renamed LLTrace::Sampler to LLTrace::Recording --- indra/llcommon/llapr.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 6efb44a663..821274aeb3 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -261,9 +261,28 @@ public: class LLThreadLocalPointerBase : LLInstanceTracker { public: - LLThreadLocalPointerBase(); - LLThreadLocalPointerBase(const LLThreadLocalPointerBase& other); - ~LLThreadLocalPointerBase(); + LLThreadLocalPointerBase() + : mThreadKey(NULL) + { + if (sInitialized) + { + initStorage(); + } + } + + LLThreadLocalPointerBase( const LLThreadLocalPointerBase& other) + : mThreadKey(NULL) + { + if (sInitialized) + { + initStorage(); + } + } + + ~LLThreadLocalPointerBase() + { + destroyStorage(); + } static void initAllThreadLocalStorage(); static void destroyAllThreadLocalStorage(); @@ -312,7 +331,6 @@ class LLThreadLocalPointer : public LLThreadLocalPointerBase public: LLThreadLocalPointer() - : LLThreadLocalPointerBase() {} explicit LLThreadLocalPointer(T* value) -- cgit v1.2.3 From 860ff2f7e2a7fe932dfb7c148f0dbc0067018038 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 7 Nov 2012 00:38:21 -0800 Subject: SH-3499 WIP Ensure asset stats output is correct fixed trace data gathering and routing from background thread simplified slave->master thread communication (eliminated redundant recording and proxy object) improved performance of fast timer data gathering (slow iterators) --- indra/llcommon/llapr.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 821274aeb3..510725ffc6 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -334,14 +334,13 @@ public: {} explicit LLThreadLocalPointer(T* value) - : LLThreadLocalPointerBase(&cleanup) { set(value); } LLThreadLocalPointer(const LLThreadLocalPointer& other) - : LLThreadLocalPointerBase(other, &cleanup) + : LLThreadLocalPointerBase(other) { set(other.get()); } -- cgit v1.2.3 From 9d77e030d9a0d23cebce616631677459eec1612c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Nov 2012 23:52:27 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system cleaning up build moved most includes of windows.h to llwin32headers.h to disable min/max macros, etc streamlined Time class and consolidated functionality in BlockTimer class llfasttimer is no longer included via llstring.h, so had to add it manually in several places --- indra/llcommon/llapr.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 510725ffc6..c77d96c1c9 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -32,16 +32,6 @@ #if LL_LINUX || LL_SOLARIS #include // Need PATH_MAX in APR headers... #endif -#if LL_WINDOWS - // Limit Windows API to small and manageable set. - // If you get undefined symbols, find the appropriate - // Windows header file and include that in your .cpp file. - #define WIN32_LEAN_AND_MEAN - #include - #include - #undef min - #undef max -#endif #include @@ -340,7 +330,7 @@ public: LLThreadLocalPointer(const LLThreadLocalPointer& other) - : LLThreadLocalPointerBase(other) + : LLThreadLocalPointerBase(other) { set(other.get()); } -- cgit v1.2.3 From c136b432140f892a56d4996d5ed77e903ff0b32d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Nov 2012 19:46:09 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system eliminated min and max macros from windows.h got rest of viewer to compile against llfasttimer changes --- indra/llcommon/llapr.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index c77d96c1c9..d9fe257e86 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -40,6 +40,7 @@ #include "apr_getopt.h" #include "apr_signal.h" #include "apr_atomic.h" + #include "llstring.h" #include "llinstancetracker.h" -- cgit v1.2.3 From 4f9a5d0554c16a81625574a7a4ad6d5070e649e3 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sat, 1 Dec 2012 12:49:01 -0800 Subject: fix for gcc compile errors --- indra/llcommon/llapr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 7ca0f505ef..199b5291dd 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -249,7 +249,7 @@ public: //******************************************************************************************************************************* }; -class LLThreadLocalPointerBase : LLInstanceTracker +class LLThreadLocalPointerBase : public LLInstanceTracker { public: LLThreadLocalPointerBase() @@ -331,7 +331,7 @@ public: LLThreadLocalPointer(const LLThreadLocalPointer& other) - : LLThreadLocalPointerBase(other) + : LLThreadLocalPointerBase(other) { set(other.get()); } -- cgit v1.2.3 From c219282f5de753a044cecb53bd806145f68add9a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 18 Dec 2012 20:07:25 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system removed some potential data races got memory stats recording in trace system --- indra/llcommon/llapr.h | 51 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 199b5291dd..f8f94263e4 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -48,6 +48,19 @@ extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp; extern apr_thread_mutex_t* gCallStacksLogMutexp; struct apr_dso_handle_t; +/** + * @brief Function which appropriately logs error or remains quiet on + * APR_SUCCESS. + * @return Returns true if status is an error condition. + */ +bool LL_COMMON_API ll_apr_warn_status(apr_status_t status); +/// There's a whole other APR error-message function if you pass a DSO handle. +bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle); + +void LL_COMMON_API ll_apr_assert_status(apr_status_t status); +void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle); + +extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool /** * @brief initialize the common apr constructs -- apr itself, the @@ -285,26 +298,26 @@ protected: { llassert(sInitialized); void* ptr; - //apr_status_t result = + apr_status_t result = apr_threadkey_private_get(&ptr, mThreadKey); - //if (result != APR_SUCCESS) - //{ - // ll_apr_warn_status(s); - // llerrs << "Failed to get thread local data" << llendl; - //} + if (result != APR_SUCCESS) + { + ll_apr_warn_status(result); + llerrs << "Failed to get thread local data" << llendl; + } return ptr; } LL_FORCE_INLINE const void* get() const { void* ptr; - //apr_status_t result = + apr_status_t result = apr_threadkey_private_get(&ptr, mThreadKey); - //if (result != APR_SUCCESS) - //{ - // ll_apr_warn_status(s); - // llerrs << "Failed to get thread local data" << llendl; - //} + if (result != APR_SUCCESS) + { + ll_apr_warn_status(result); + llerrs << "Failed to get thread local data" << llendl; + } return ptr; } @@ -379,18 +392,4 @@ public: } }; -/** - * @brief Function which appropriately logs error or remains quiet on - * APR_SUCCESS. - * @return Returns true if status is an error condition. - */ -bool LL_COMMON_API ll_apr_warn_status(apr_status_t status); -/// There's a whole other APR error-message function if you pass a DSO handle. -bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle); - -void LL_COMMON_API ll_apr_assert_status(apr_status_t status); -void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle); - -extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool - #endif // LL_LLAPR_H -- cgit v1.2.3 From 013f04cabec8e110ee659d9b3f75a4d25f114b7b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 21 Dec 2012 00:13:21 -0800 Subject: SH-3468 WIP add memory tracking base class improvements on lifetime of lltrace core data structures tweaks to thread local pointer handling so that static constructors/destructors can safely call functions that use lltrace --- indra/llcommon/llapr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index f8f94263e4..2faf4aad2d 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -296,7 +296,7 @@ protected: LL_FORCE_INLINE void* get() { - llassert(sInitialized); + // llassert(sInitialized); void* ptr; apr_status_t result = apr_threadkey_private_get(&ptr, mThreadKey); -- cgit v1.2.3 From 3fd640a6e3dea7a3551c239323d782fb082e1dbd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 23 Dec 2012 12:27:25 -0800 Subject: SH-3468 WIP add memory tracking base class fixed crash on exit by making LLInstanceTracker iterators use atomic iterator nesting count for thread safety --- indra/llcommon/llapr.h | 137 ++----------------------------------------------- 1 file changed, 5 insertions(+), 132 deletions(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 2faf4aad2d..b3c9bfd58c 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -42,7 +42,6 @@ #include "apr_atomic.h" #include "llstring.h" -#include "llinstancetracker.h" extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp; extern apr_thread_mutex_t* gCallStacksLogMutexp; @@ -170,14 +169,17 @@ public: LLAtomic32(Type x) {apr_atomic_set32(&mData, apr_uint32_t(x)); }; ~LLAtomic32() {}; - operator const Type() { apr_uint32_t data = apr_atomic_read32(&mData); return Type(data); } + operator const Type() { return get(); } Type operator =(const Type& x) { apr_atomic_set32(&mData, apr_uint32_t(x)); return Type(mData); } void operator -=(Type x) { apr_atomic_sub32(&mData, apr_uint32_t(x)); } void operator +=(Type x) { apr_atomic_add32(&mData, apr_uint32_t(x)); } Type operator ++(int) { return apr_atomic_inc32(&mData); } // Type++ - Type operator --(int) { return apr_atomic_dec32(&mData); } // approximately --Type (0 if final is 0, non-zero otherwise) + Type operator ++() { apr_atomic_inc32(&mData); return get(); } // ++Type + Type operator --(int) { const Type result(get()); apr_atomic_dec32(&mData); return result; } // Type-- + Type operator --() { return apr_atomic_dec32(&mData); } // approximately --Type (0 if final is 0, non-zero otherwise) private: + const Type get() { apr_uint32_t data = apr_atomic_read32(&mData); return Type(data); } apr_uint32_t mData; }; @@ -262,134 +264,5 @@ public: //******************************************************************************************************************************* }; -class LLThreadLocalPointerBase : public LLInstanceTracker -{ -public: - LLThreadLocalPointerBase() - : mThreadKey(NULL) - { - if (sInitialized) - { - initStorage(); - } - } - - LLThreadLocalPointerBase( const LLThreadLocalPointerBase& other) - : mThreadKey(NULL) - { - if (sInitialized) - { - initStorage(); - } - } - - ~LLThreadLocalPointerBase() - { - destroyStorage(); - } - - static void initAllThreadLocalStorage(); - static void destroyAllThreadLocalStorage(); - -protected: - void set(void* value); - - LL_FORCE_INLINE void* get() - { - // llassert(sInitialized); - void* ptr; - apr_status_t result = - apr_threadkey_private_get(&ptr, mThreadKey); - if (result != APR_SUCCESS) - { - ll_apr_warn_status(result); - llerrs << "Failed to get thread local data" << llendl; - } - return ptr; - } - - LL_FORCE_INLINE const void* get() const - { - void* ptr; - apr_status_t result = - apr_threadkey_private_get(&ptr, mThreadKey); - if (result != APR_SUCCESS) - { - ll_apr_warn_status(result); - llerrs << "Failed to get thread local data" << llendl; - } - return ptr; - } - - void initStorage(); - void destroyStorage(); - -protected: - apr_threadkey_t* mThreadKey; - static bool sInitialized; -}; - -template -class LLThreadLocalPointer : public LLThreadLocalPointerBase -{ -public: - - LLThreadLocalPointer() - {} - - explicit LLThreadLocalPointer(T* value) - { - set(value); - } - - - LLThreadLocalPointer(const LLThreadLocalPointer& other) - : LLThreadLocalPointerBase(other) - { - set(other.get()); - } - - LL_FORCE_INLINE T* get() - { - return (T*)LLThreadLocalPointerBase::get(); - } - - const T* get() const - { - return (const T*)LLThreadLocalPointerBase::get(); - } - - T* operator -> () - { - return (T*)get(); - } - - const T* operator -> () const - { - return (T*)get(); - } - - T& operator*() - { - return *(T*)get(); - } - - const T& operator*() const - { - return *(T*)get(); - } - - LLThreadLocalPointer& operator = (T* value) - { - set((void*)value); - return *this; - } - - bool operator ==(T* other) - { - if (!sInitialized) return false; - return get() == other; - } -}; #endif // LL_LLAPR_H -- cgit v1.2.3 From 68413515029f50713c70e4adec3ce6fd1022d59f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 6 Jan 2013 21:37:31 -0800 Subject: SH-3468 WIP add memory tracking base class fix for unit test failures...cleanup apr without destroying pools, allowing LLProxy to clean itself up as a singleton (and avoiding spurious dependencies associated with manually destorying singletons that rely on apr pools) --- indra/llcommon/llapr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index b3c9bfd58c..424ddc6505 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -70,7 +70,7 @@ void LL_COMMON_API ll_init_apr(); /** * @brief Cleanup those common apr constructs. */ -void LL_COMMON_API ll_cleanup_apr(); +void LL_COMMON_API ll_cleanup_apr(bool destroy_pools = true); // //LL apr_pool -- cgit v1.2.3 From 3c341a11ab7b8f3fd18afcf3f50af6dfafa632c2 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 8 Jan 2013 00:25:07 -0800 Subject: SH-3468 WIP add memory tracking base class more fixes for unit test crashes added llcommon initialization/teardown for unit tests that indirectly trigger lltrace changed access of atomic refcount to use preincrement/decrement operators to reflect desired semantics always call apr_initialize in LLCommon::initClass, even if already initialized...apr does internal reference counting to keep things straight --- indra/llcommon/llapr.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/llapr.h') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 424ddc6505..3b65c0dc34 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -70,7 +70,10 @@ void LL_COMMON_API ll_init_apr(); /** * @brief Cleanup those common apr constructs. */ -void LL_COMMON_API ll_cleanup_apr(bool destroy_pools = true); +void LL_COMMON_API ll_cleanup_apr(); + +bool LL_COMMON_API ll_apr_is_initialized(); + // //LL apr_pool -- cgit v1.2.3