diff --git a/indra/llcommon/llrefcount.cpp b/indra/llcommon/llrefcount.cpp index a638df2c7ccd5dfb29d5cc31f36b704d741025c4..29a5ca6f245cbec59e6be9205607a415fc4e050b 100644 --- a/indra/llcommon/llrefcount.cpp +++ b/indra/llcommon/llrefcount.cpp @@ -29,25 +29,9 @@ #include "llerror.h" -#if LL_REF_COUNT_DEBUG -#include "llthread.h" -#include "llapr.h" -#endif - LLRefCount::LLRefCount(const LLRefCount& other) : mRef(0) { -#if LL_REF_COUNT_DEBUG - if(gAPRPoolp) - { - mMutexp = new LLMutex(gAPRPoolp) ; - } - else - { - mMutexp = NULL ; - } - mCrashAtUnlock = FALSE ; -#endif } LLRefCount& LLRefCount::operator=(const LLRefCount&) @@ -59,17 +43,6 @@ LLRefCount& LLRefCount::operator=(const LLRefCount&) LLRefCount::LLRefCount() : mRef(0) { -#if LL_REF_COUNT_DEBUG - if(gAPRPoolp) - { - mMutexp = new LLMutex(gAPRPoolp) ; - } - else - { - mMutexp = NULL ; - } - mCrashAtUnlock = FALSE ; -#endif } LLRefCount::~LLRefCount() @@ -78,87 +51,5 @@ LLRefCount::~LLRefCount() { LL_ERRS() << "deleting non-zero reference" << LL_ENDL; } - -#if LL_REF_COUNT_DEBUG - if(gAPRPoolp) - { - delete mMutexp ; - } -#endif } -#if LL_REF_COUNT_DEBUG -void LLRefCount::ref() const -{ - if(mMutexp) - { - if(mMutexp->isLocked()) - { - mCrashAtUnlock = TRUE ; - LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID - << " Current thread: " << LLThread::currentID() << LL_ENDL ; - } - - mMutexp->lock() ; - mLockedThreadID = LLThread::currentID() ; - - mRef++; - - if(mCrashAtUnlock) - { - while(1); //crash here. - } - mMutexp->unlock() ; - } - else - { - mRef++; - } -} - -S32 LLRefCount::unref() const -{ - if(mMutexp) - { - if(mMutexp->isLocked()) - { - mCrashAtUnlock = TRUE ; - LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID - << " Current thread: " << LLThread::currentID() << LL_ENDL ; - } - - mMutexp->lock() ; - mLockedThreadID = LLThread::currentID() ; - - llassert(mRef >= 1); - if (0 == --mRef) - { - if(mCrashAtUnlock) - { - while(1); //crash here. - } - mMutexp->unlock() ; - - delete this; - return 0; - } - - if(mCrashAtUnlock) - { - while(1); //crash here. - } - mMutexp->unlock() ; - return mRef; - } - else - { - llassert(mRef >= 1); - if (0 == --mRef) - { - delete this; - return 0; - } - return mRef; - } -} -#endif diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 11079735691b58be85916e4e34db789d456d8cb8..cdc60fa54ffea34584b1d58fad85ebe2467dfe31 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -31,11 +31,6 @@ #include "llmutex.h" #include "llapr.h" -#define LL_REF_COUNT_DEBUG 0 -#if LL_REF_COUNT_DEBUG -class LLMutex ; -#endif - //---------------------------------------------------------------------------- // RefCount objects should generally only be accessed by way of LLPointer<>'s // see llthread.h for LLThreadSafeRefCount @@ -51,10 +46,6 @@ class LL_COMMON_API LLRefCount public: LLRefCount(); -#if LL_REF_COUNT_DEBUG - void ref() const ; - S32 unref() const ; -#else inline void ref() const { mRef++; @@ -69,8 +60,7 @@ class LL_COMMON_API LLRefCount return 0; } return mRef; - } -#endif + } //NOTE: when passing around a const LLRefCount object, this can return different results // at different types, since mRef is mutable @@ -81,12 +71,6 @@ class LL_COMMON_API LLRefCount private: mutable S32 mRef; - -#if LL_REF_COUNT_DEBUG - LLMutex* mMutexp ; - mutable U32 mLockedThreadID ; - mutable BOOL mCrashAtUnlock ; -#endif }; diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index 506ccc98a4b315ab0baab35b394d8f524779a779..a2524e98043f6ec2dd17f01aa767966d9ed70715 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -54,11 +54,7 @@ // constants for poll timeout. if we are threading, we want to have a // longer poll timeout. -#if LL_THREADS_APR -static const S32 DEFAULT_POLL_TIMEOUT = 1000; -#else static const S32 DEFAULT_POLL_TIMEOUT = 0; -#endif // The default (and fallback) expiration time for chains const F32 DEFAULT_CHAIN_EXPIRY_SECS = 30.0f; @@ -169,8 +165,6 @@ LLPumpIO::LLPumpIO(apr_pool_t* pool) : mPool(NULL), mCurrentPool(NULL), mCurrentPoolReallocCount(0), - mChainsMutex(NULL), - mCallbackMutex(NULL), mCurrentChain(mRunningChains.end()) { mCurrentChain = mRunningChains.end(); @@ -194,9 +188,6 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request { if(chain.empty()) return false; -#if LL_THREADS_APR - LLScopedLock lock(mChainsMutex); -#endif LLChainInfo info; info.mHasCurlRequest = has_curl_request; info.setTimeoutSeconds(timeout); @@ -234,9 +225,6 @@ bool LLPumpIO::addChain( if(!data) return false; if(links.empty()) return false; -#if LL_THREADS_APR - LLScopedLock lock(mChainsMutex); -#endif #if LL_DEBUG_PIPE_TYPE_IN_PUMP LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '" << typeid(*(links[0].mPipe)).name() << "'" << LL_ENDL; @@ -391,9 +379,6 @@ void LLPumpIO::clearLock(S32 key) // therefore won't be treading into deleted memory. I think we can // also clear the lock on the chain safely since the pump only // reads that value. -#if LL_THREADS_APR - LLScopedLock lock(mChainsMutex); -#endif mClearLocks.insert(key); } @@ -457,9 +442,6 @@ void LLPumpIO::pump(const S32& poll_timeout) PUMP_DEBUG; if(true) { -#if LL_THREADS_APR - LLScopedLock lock(mChainsMutex); -#endif // bail if this pump is paused. if(PAUSING == mState) { @@ -724,25 +706,10 @@ void LLPumpIO::pump(const S32& poll_timeout) END_PUMP_DEBUG; } -//bool LLPumpIO::respond(const chain_t& pipes) -//{ -//#if LL_THREADS_APR -// LLScopedLock lock(mCallbackMutex); -//#endif -// LLChainInfo info; -// links_t links; -// -// mPendingCallbacks.push_back(info); -// return true; -//} - bool LLPumpIO::respond(LLIOPipe* pipe) { if(NULL == pipe) return false; -#if LL_THREADS_APR - LLScopedLock lock(mCallbackMutex); -#endif LLChainInfo info; LLLinkInfo link; link.mPipe = pipe; @@ -761,10 +728,6 @@ bool LLPumpIO::respond( if(!data) return false; if(links.empty()) return false; -#if LL_THREADS_APR - LLScopedLock lock(mCallbackMutex); -#endif - // Add the callback response LLChainInfo info; info.mChainLinks = links; @@ -781,9 +744,6 @@ void LLPumpIO::callback() //LL_INFOS() << "LLPumpIO::callback()" << LL_ENDL; if(true) { -#if LL_THREADS_APR - LLScopedLock lock(mCallbackMutex); -#endif std::copy( mPendingCallbacks.begin(), mPendingCallbacks.end(), @@ -809,9 +769,6 @@ void LLPumpIO::callback() void LLPumpIO::control(LLPumpIO::EControl op) { -#if LL_THREADS_APR - LLScopedLock lock(mChainsMutex); -#endif switch(op) { case PAUSE: @@ -829,22 +786,11 @@ void LLPumpIO::control(LLPumpIO::EControl op) void LLPumpIO::initialize(apr_pool_t* pool) { if(!pool) return; -#if LL_THREADS_APR - // SJB: Windows defaults to NESTED and OSX defaults to UNNESTED, so use UNNESTED explicitly. - apr_thread_mutex_create(&mChainsMutex, APR_THREAD_MUTEX_UNNESTED, pool); - apr_thread_mutex_create(&mCallbackMutex, APR_THREAD_MUTEX_UNNESTED, pool); -#endif mPool = pool; } void LLPumpIO::cleanup() { -#if LL_THREADS_APR - if(mChainsMutex) apr_thread_mutex_destroy(mChainsMutex); - if(mCallbackMutex) apr_thread_mutex_destroy(mCallbackMutex); -#endif - mChainsMutex = NULL; - mCallbackMutex = NULL; if(mPollset) { // LL_DEBUGS() << "cleaning up pollset" << LL_ENDL; diff --git a/indra/llmessage/llpumpio.h b/indra/llmessage/llpumpio.h index d2c5d3757136e57caaba21b02a01d812090c3e0f..b9eabee710f2584da95f378e1c689e54122e3496 100644 --- a/indra/llmessage/llpumpio.h +++ b/indra/llmessage/llpumpio.h @@ -40,9 +40,6 @@ #include "lliopipe.h" #include "llrun.h" -// Define this to enable use with the APR thread library. -//#define LL_THREADS_APR 1 - // some simple constants to help with timeouts extern const F32 DEFAULT_CHAIN_EXPIRY_SECS; extern const F32 SHORT_CHAIN_EXPIRY_SECS; @@ -393,14 +390,6 @@ class LLPumpIO apr_pool_t* mCurrentPool; S32 mCurrentPoolReallocCount; -#if LL_THREADS_APR - apr_thread_mutex_t* mChainsMutex; - apr_thread_mutex_t* mCallbackMutex; -#else - int* mChainsMutex; - int* mCallbackMutex; -#endif - protected: void initialize(apr_pool_t* pool); void cleanup(); diff --git a/indra/llvfs/lllfsthread.h b/indra/llvfs/lllfsthread.h index cdb5c759465495390d6ed38205a04771286f016a..58f658f7bab32d61ce5feff83615a53dae70254e 100644 --- a/indra/llvfs/lllfsthread.h +++ b/indra/llvfs/lllfsthread.h @@ -32,7 +32,6 @@ #include <map> #include <set> -#include "llapr.h" #include "llpointer.h" #include "llqueuedthread.h" diff --git a/indra/llvfs/llvfsthread.h b/indra/llvfs/llvfsthread.h index 95f3c857c6ffb3557418d1bf98aca662938243e3..7814de4a2d91ae9721a31a3803ed40f4c88b8450 100644 --- a/indra/llvfs/llvfsthread.h +++ b/indra/llvfs/llvfsthread.h @@ -32,8 +32,6 @@ #include <map> #include <set> -#include "llapr.h" - #include "llqueuedthread.h" #include "llvfs.h" diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index cfa312ccd95b2dabd94a3cb2b960aabce98cc155..19369137b725809c7e2f8a21123f11ac0b2a8cd0 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -35,7 +35,6 @@ #include "lluuid.h" #include "llworkerthread.h" #include "lltextureinfo.h" -#include "llapr.h" #include "llimageworker.h" #include "httprequest.h" #include "httpoptions.h"