summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-07-18 15:09:45 -0700
committerRichard Linden <none@none>2013-07-18 15:09:45 -0700
commit075a7bcc980b0ca0d2888d344b6afa8ab5b52d85 (patch)
tree162daed1e3e4da73d0e086c5dba1ef9a4a8ed4c4 /indra/llcommon
parent862cdf3061d66dfe4ae482f24436960b136a3ce4 (diff)
SH-4297 WIP interesting: viewer-interesting starts loading cached scene late
dependency cleanup - removed a lot of unecessary includes
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-xindra/llcommon/llevent.h1
-rwxr-xr-xindra/llcommon/llinstancetracker.h3
-rw-r--r--indra/llcommon/llmutex.h21
-rwxr-xr-xindra/llcommon/llpointer.h79
-rwxr-xr-xindra/llcommon/llptrto.h1
-rwxr-xr-xindra/llcommon/llsdparam.cpp1
-rwxr-xr-xindra/llcommon/llthread.h81
-rw-r--r--indra/llcommon/lltrace.h3
-rw-r--r--indra/llcommon/llunit.h26
9 files changed, 114 insertions, 102 deletions
diff --git a/indra/llcommon/llevent.h b/indra/llcommon/llevent.h
index 8cd682b8bf..9d3a7a654a 100755
--- a/indra/llcommon/llevent.h
+++ b/indra/llcommon/llevent.h
@@ -30,7 +30,6 @@
#include "llsd.h"
#include "llpointer.h"
-#include "llthread.h"
namespace LLOldEvents
{
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index c8e1d9cd84..f4e37d21fe 100755
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -32,9 +32,6 @@
#include <typeinfo>
#include "string_table.h"
-#include <boost/utility.hpp>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/indirect_iterator.hpp>
diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h
index cbde4c47a9..db5b9357d9 100644
--- a/indra/llcommon/llmutex.h
+++ b/indra/llcommon/llmutex.h
@@ -27,13 +27,16 @@
#ifndef LL_LLMUTEX_H
#define LL_LLMUTEX_H
-#include "llapr.h"
-#include "apr_thread_cond.h"
+#include "stdtypes.h"
//============================================================================
#define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO)
+struct apr_thread_mutex_t;
+struct apr_pool_t;
+struct apr_thread_cond_t;
+
class LL_COMMON_API LLMutex
{
public:
@@ -45,18 +48,18 @@ public:
LLMutex(apr_pool_t *apr_poolp = NULL); // NULL pool constructs a new pool for the mutex
virtual ~LLMutex();
- void lock(); // blocks
+ void lock(); // blocks
void unlock();
- bool isLocked(); // non-blocking, but does do a lock/unlock so not free
- bool isSelfLocked(); //return true if locked in a same thread
+ bool isLocked(); // non-blocking, but does do a lock/unlock so not free
+ bool isSelfLocked(); //return true if locked in a same thread
U32 lockingThread() const; //get ID of locking thread
protected:
- apr_thread_mutex_t *mAPRMutexp;
+ apr_thread_mutex_t* mAPRMutexp;
mutable U32 mCount;
mutable U32 mLockingThread;
- apr_pool_t *mAPRPoolp;
+ apr_pool_t* mAPRPoolp;
BOOL mIsLocalPool;
#if MUTEX_DEBUG
@@ -68,7 +71,7 @@ protected:
class LL_COMMON_API LLCondition : public LLMutex
{
public:
- LLCondition(apr_pool_t *apr_poolp); // Defaults to global pool, could use the thread pool as well.
+ LLCondition(apr_pool_t* apr_poolp); // Defaults to global pool, could use the thread pool as well.
~LLCondition();
void wait(); // blocks
@@ -76,7 +79,7 @@ public:
void broadcast();
protected:
- apr_thread_cond_t *mAPRCondp;
+ apr_thread_cond_t* mAPRCondp;
};
class LLMutexLock
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h
index c827996db1..9a0726c338 100755
--- a/indra/llcommon/llpointer.h
+++ b/indra/llcommon/llpointer.h
@@ -27,6 +27,7 @@
#define LLPOINTER_H
#include "llerror.h" // *TODO: consider eliminating this
+#include "llmutex.h"
//----------------------------------------------------------------------------
// RefCount objects should generally only be accessed by way of LLPointer<>'s
@@ -213,4 +214,82 @@ private:
bool mStayUnique;
};
+//============================================================================
+
+// see llmemory.h for LLPointer<> definition
+
+class LL_COMMON_API LLThreadSafeRefCount
+{
+public:
+ static void initThreadSafeRefCount(); // creates sMutex
+ static void cleanupThreadSafeRefCount(); // destroys sMutex
+
+private:
+ static LLMutex* sMutex;
+
+protected:
+ virtual ~LLThreadSafeRefCount(); // use unref()
+
+public:
+ LLThreadSafeRefCount();
+ LLThreadSafeRefCount(const LLThreadSafeRefCount&);
+ LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)
+ {
+ if (sMutex)
+ {
+ sMutex->lock();
+ }
+ mRef = 0;
+ if (sMutex)
+ {
+ sMutex->unlock();
+ }
+ return *this;
+ }
+
+ void ref()
+ {
+ if (sMutex) sMutex->lock();
+ mRef++;
+ if (sMutex) sMutex->unlock();
+ }
+
+ S32 unref()
+ {
+ llassert(mRef >= 1);
+ if (sMutex) sMutex->lock();
+ S32 res = --mRef;
+ if (sMutex) sMutex->unlock();
+ if (0 == res)
+ {
+ delete this;
+ return 0;
+ }
+ return res;
+ }
+ S32 getNumRefs() const
+ {
+ return mRef;
+ }
+
+private:
+ S32 mRef;
+};
+
+/**
+ * intrusive pointer support for LLThreadSafeRefCount
+ * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type
+ */
+namespace boost
+{
+ inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p)
+ {
+ p->ref();
+ }
+
+ inline void intrusive_ptr_release(LLThreadSafeRefCount* p)
+ {
+ p->unref();
+ }
+};
#endif
diff --git a/indra/llcommon/llptrto.h b/indra/llcommon/llptrto.h
index 7091d36f6b..4082e30de6 100755
--- a/indra/llcommon/llptrto.h
+++ b/indra/llcommon/llptrto.h
@@ -33,7 +33,6 @@
#include "llpointer.h"
#include "llrefcount.h" // LLRefCount
-#include "llthread.h" // LLThreadSafeRefCount
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/utility/enable_if.hpp>
diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp
index 50815b2cc6..c1ba777543 100755
--- a/indra/llcommon/llsdparam.cpp
+++ b/indra/llcommon/llsdparam.cpp
@@ -30,6 +30,7 @@
// Project includes
#include "llsdparam.h"
#include "llsdutil.h"
+#include "boost/bind.hpp"
static LLInitParam::Parser::parser_read_func_map_t sReadFuncs;
static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs;
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index 4a84a14a65..c2c6b8e7ac 100755
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -32,6 +32,7 @@
#include "apr_thread_cond.h"
#include "boost/intrusive_ptr.hpp"
#include "llmutex.h"
+#include "llpointer.h"
LL_COMMON_API void assert_main_thread();
@@ -148,86 +149,6 @@ void LLThread::unlockData()
//============================================================================
-// see llmemory.h for LLPointer<> definition
-
-class LL_COMMON_API LLThreadSafeRefCount
-{
-public:
- static void initThreadSafeRefCount(); // creates sMutex
- static void cleanupThreadSafeRefCount(); // destroys sMutex
-
-private:
- static LLMutex* sMutex;
-
-protected:
- virtual ~LLThreadSafeRefCount(); // use unref()
-
-public:
- LLThreadSafeRefCount();
- LLThreadSafeRefCount(const LLThreadSafeRefCount&);
- LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)
- {
- if (sMutex)
- {
- sMutex->lock();
- }
- mRef = 0;
- if (sMutex)
- {
- sMutex->unlock();
- }
- return *this;
- }
-
-
-
- void ref()
- {
- if (sMutex) sMutex->lock();
- mRef++;
- if (sMutex) sMutex->unlock();
- }
-
- S32 unref()
- {
- llassert(mRef >= 1);
- if (sMutex) sMutex->lock();
- S32 res = --mRef;
- if (sMutex) sMutex->unlock();
- if (0 == res)
- {
- delete this;
- return 0;
- }
- return res;
- }
- S32 getNumRefs() const
- {
- return mRef;
- }
-
-private:
- S32 mRef;
-};
-
-/**
- * intrusive pointer support for LLThreadSafeRefCount
- * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type
- */
-namespace boost
-{
- inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p)
- {
- p->ref();
- }
-
- inline void intrusive_ptr_release(LLThreadSafeRefCount* p)
- {
- p->unref();
- }
-};
-//============================================================================
-
// Simple responder for self destructing callbacks
// Pure virtual class
class LL_COMMON_API LLResponder : public LLThreadSafeRefCount
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 2c84b1596a..75e913a348 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -123,6 +123,7 @@ class EventStatHandle
public:
typedef F64 storage_t;
typedef TraceType<EventAccumulator> trace_t;
+ typedef EventStatHandle<T> self_t;
EventStatHandle(const char* name, const char* description = NULL)
: trace_t(name, description)
@@ -146,6 +147,7 @@ class SampleStatHandle
public:
typedef F64 storage_t;
typedef TraceType<SampleAccumulator> trace_t;
+ typedef SampleStatHandle<T> self_t;
SampleStatHandle(const char* name, const char* description = NULL)
: trace_t(name, description)
@@ -168,6 +170,7 @@ class CountStatHandle
public:
typedef F64 storage_t;
typedef TraceType<CountAccumulator> trace_t;
+ typedef CountStatHandle<T> self_t;
CountStatHandle(const char* name, const char* description = NULL)
: trace_t(name, description)
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index 79465715cf..731cc0eded 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -30,12 +30,12 @@
#include "stdtypes.h"
#include "llpreprocessor.h"
#include "llerrorlegacy.h"
-#include <boost/type_traits/is_same.hpp>
template<typename STORAGE_TYPE, typename UNIT_TYPE>
struct LLUnit
{
typedef LLUnit<STORAGE_TYPE, UNIT_TYPE> self_t;
+
typedef STORAGE_TYPE storage_t;
// value initialization
@@ -163,18 +163,28 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNIT_TYPE>
};
+template<typename S, typename T>
+struct LLIsSameType
+{
+ static const bool value = false;
+};
+
+template<typename T>
+struct LLIsSameType<T, T>
+{
+ static const bool value = true;
+};
+
template<typename S1, typename T1, typename S2, typename T2>
LL_FORCE_INLINE void ll_convert_units(LLUnit<S1, T1> in, LLUnit<S2, T2>& out, ...)
{
- typedef boost::integral_constant<bool,
- boost::is_same<T1, T2>::value
- || !boost::is_same<T1, typename T1::base_unit_t>::value
- || !boost::is_same<T2, typename T2::base_unit_t>::value> conversion_valid_t;
- LL_STATIC_ASSERT(conversion_valid_t::value, "invalid conversion");
+ LL_STATIC_ASSERT((LLIsSameType<T1, T2>::value
+ || !LLIsSameType<T1, typename T1::base_unit_t>::value
+ || !LLIsSameType<T2, typename T2::base_unit_t>::value), "invalid conversion");
- if (boost::is_same<T1, typename T1::base_unit_t>::value)
+ if (LLIsSameType<T1, typename T1::base_unit_t>::value)
{
- if (boost::is_same<T2, typename T2::base_unit_t>::value)
+ if (LLIsSameType<T2, typename T2::base_unit_t>::value)
{
// T1 and T2 fully reduced and equal...just copy