From ef20e3f523a8f435b1f3d851b347dd56979d1b9f Mon Sep 17 00:00:00 2001 From: Nicky Date: Thu, 5 Apr 2018 12:02:12 +0200 Subject: [PATCH] Replace ARP Mutex and Condition with std::mutx and std::conditional_variable --- indra/llcommon/llapr.cpp | 58 +++++----------- indra/llcommon/llapr.h | 22 ++++-- indra/llcommon/llerror.cpp | 5 +- indra/llcommon/llfixedbuffer.cpp | 3 +- indra/llcommon/llmemory.cpp | 2 +- indra/llcommon/llmutex.cpp | 67 ++++++------------- indra/llcommon/llmutex.h | 22 +++--- indra/llcommon/llqueuedthread.cpp | 2 +- indra/llcommon/llthread.cpp | 6 +- indra/llcommon/lluuid.cpp | 2 +- indra/llcommon/llworkerthread.cpp | 3 +- indra/llcorehttp/httpcommon.cpp | 4 +- indra/llimage/llimage.cpp | 2 +- indra/llimage/llimageworker.cpp | 2 +- indra/llmath/llvolumemgr.cpp | 2 +- indra/llmessage/llbuffer.cpp | 2 +- indra/llmessage/llproxy.cpp | 1 - indra/llmessage/llpumpio.h | 4 +- indra/llplugin/llpluginmessagepipe.cpp | 2 - indra/llplugin/llpluginprocessparent.cpp | 5 +- indra/llvfs/llvfs.cpp | 2 +- indra/newview/llappviewer.cpp | 2 +- .../newview/llfloaterconversationpreview.cpp | 1 - indra/newview/llfloatermodelpreview.cpp | 4 +- indra/newview/lllogchat.cpp | 4 +- indra/newview/llmeshrepository.cpp | 14 ++-- indra/newview/lltexturecache.cpp | 4 -- indra/newview/lltexturefetch.cpp | 3 - indra/newview/llviewermenufile.cpp | 2 +- indra/newview/llwatchdog.cpp | 2 +- 30 files changed, 101 insertions(+), 153 deletions(-) diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index d353d06de2..33c3d5db20 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -33,8 +33,8 @@ 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; +std::mutex *gLogMutexp = nullptr; +std::mutex *gCallStacksLogMutexp = nullptr; const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool @@ -49,9 +49,8 @@ void ll_init_apr() { apr_pool_create(&gAPRPoolp, NULL); - // Initialize the logging mutex - apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp); - apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp); + gLogMutexp = new std::mutex(); + gCallStacksLogMutexp = new std::mutex(); } if(!LLAPRFile::sAPRFilePoolp) @@ -75,22 +74,12 @@ void ll_cleanup_apr() LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL; - if (gLogMutexp) - { - // 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(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; - } + // Clean up the logging mutex + // All other threads NEED to be done before we clean up APR, so this is okay. + delete gLogMutexp; + gLogMutexp = nullptr; + delete gCallStacksLogMutexp; + gCallStacksLogMutexp = nullptr; LLThreadLocalPointerBase::destroyAllThreadLocalStorage(); @@ -176,18 +165,14 @@ LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size if(!is_local) //not a local apr_pool, that is: shared by multiple threads. { apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex - apr_thread_mutex_create(&mMutexp, APR_THREAD_MUTEX_UNNESTED, mMutexPool); + mMutexp = new std::mutex(); } } LLVolatileAPRPool::~LLVolatileAPRPool() { - //delete mutex - if(mMutexp) - { - apr_thread_mutex_destroy(mMutexp); - apr_pool_destroy(mMutexPool); - } + delete mMutexp; + mMutexp = nullptr; } // @@ -254,18 +239,12 @@ BOOL LLVolatileAPRPool::isFull() // // LLScopedLock // -LLScopedLock::LLScopedLock(apr_thread_mutex_t* mutex) : mMutex(mutex) +LLScopedLock::LLScopedLock(std::mutex* mutex) : mMutex(mutex) { if(mutex) { - if(ll_apr_warn_status(apr_thread_mutex_lock(mMutex))) - { - mLocked = false; - } - else - { - mLocked = true; - } + mutex->lock(); + mLocked = true; } else { @@ -282,10 +261,7 @@ void LLScopedLock::unlock() { if(mLocked) { - if(!ll_apr_warn_status(apr_thread_mutex_unlock(mMutex))) - { - mLocked = false; - } + mMutex->unlock(); } } diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 5ff9082e30..d08014b5ef 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -36,15 +36,25 @@ #include #include "llwin32headerslean.h" #include "apr_thread_proc.h" -#include "apr_thread_mutex.h" + #include "apr_getopt.h" #include "apr_signal.h" #include +#if LL_WINDOWS +#pragma warning(disable:4265) +#endif + +#include + +#if LL_WINDOWS +#pragma warning(default:4265) +#endif + #include "llstring.h" -extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp; -extern apr_thread_mutex_t* gCallStacksLogMutexp; +extern LL_COMMON_API std::mutex* gLogMutexp; +extern std::mutex* gCallStacksLogMutexp; struct apr_dso_handle_t; /** @@ -120,7 +130,7 @@ private: S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool. S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating. - apr_thread_mutex_t *mMutexp; + std::mutex *mMutexp; apr_pool_t *mMutexPool; } ; @@ -142,7 +152,7 @@ public: * @param mutex An allocated APR mutex. If you pass in NULL, * this wrapper will not lock. */ - LLScopedLock(apr_thread_mutex_t* mutex); + LLScopedLock( std::mutex* mutex ); /** * @brief Destructor which unlocks the mutex if still locked. @@ -161,7 +171,7 @@ public: protected: bool mLocked; - apr_thread_mutex_t* mMutex; + std::mutex* mMutex; }; template class LLAtomic diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index f31a054139..fdea42d08a 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1018,8 +1018,7 @@ namespace { const int MAX_RETRIES = 5; for (int attempts = 0; attempts < MAX_RETRIES; ++attempts) { - apr_status_t s = apr_thread_mutex_trylock(gLogMutexp); - if (!APR_STATUS_IS_EBUSY(s)) + if( gLogMutexp->try_lock() ) { mLocked = true; mOK = true; @@ -1041,7 +1040,7 @@ namespace { { if (mLocked) { - apr_thread_mutex_unlock(gLogMutexp); + gLogMutexp->unlock(); } } } diff --git a/indra/llcommon/llfixedbuffer.cpp b/indra/llcommon/llfixedbuffer.cpp index d394f179fb..4b5cdbe288 100644 --- a/indra/llcommon/llfixedbuffer.cpp +++ b/indra/llcommon/llfixedbuffer.cpp @@ -30,8 +30,7 @@ LLFixedBuffer::LLFixedBuffer(const U32 max_lines) : LLLineBuffer(), - mMaxLines(max_lines), - mMutex(NULL) + mMaxLines(max_lines) { mTimer.reset(); } diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 049e962638..bcf30ff9a6 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -1122,7 +1122,7 @@ LLPrivateMemoryPool::LLPrivateMemoryPool(S32 type, U32 max_pool_size) : { if(type == STATIC_THREADED || type == VOLATILE_THREADED) { - mMutexp = new LLMutex(NULL) ; + mMutexp = new LLMutex() ; } for(S32 i = 0 ; i < SUPER_ALLOCATION ; i++) diff --git a/indra/llcommon/llmutex.cpp b/indra/llcommon/llmutex.cpp index 9c13ef9e30..1090acd9fd 100644 --- a/indra/llcommon/llmutex.cpp +++ b/indra/llcommon/llmutex.cpp @@ -33,20 +33,11 @@ //============================================================================ -LLMutex::LLMutex(apr_pool_t *poolp) : - mAPRMutexp(NULL), mCount(0), mLockingThread(NO_THREAD) +LLMutex::LLMutex() : + mCount(0), mLockingThread(NO_THREAD) { - //if (poolp) - //{ - // mIsLocalPool = FALSE; - // mAPRPoolp = poolp; - //} - //else - { - mIsLocalPool = TRUE; - apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread - } - apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mAPRPoolp); + + mMutexp = new std::mutex(); } @@ -56,15 +47,8 @@ LLMutex::~LLMutex() //bad assertion, the subclass LLSignal might be "locked", and that's OK //llassert_always(!isLocked()); // better not be locked! #endif - if (ll_apr_is_initialized()) - { - apr_thread_mutex_destroy(mAPRMutexp); - if (mIsLocalPool) - { - apr_pool_destroy(mAPRPoolp); - } - } - mAPRMutexp = NULL; + delete mMutexp; + mMutexp = nullptr; } @@ -76,7 +60,7 @@ void LLMutex::lock() return; } - apr_thread_mutex_lock(mAPRMutexp); + mMutexp->lock(); #if MUTEX_DEBUG // Have to have the lock before we can access the debug info @@ -106,19 +90,18 @@ void LLMutex::unlock() #endif mLockingThread = NO_THREAD; - apr_thread_mutex_unlock(mAPRMutexp); + mMutexp->unlock(); } bool LLMutex::isLocked() { - apr_status_t status = apr_thread_mutex_trylock(mAPRMutexp); - if (APR_STATUS_IS_EBUSY(status)) + if (!mMutexp->try_lock()) { return true; } else { - apr_thread_mutex_unlock(mAPRMutexp); + mMutexp->unlock(); return false; } } @@ -141,8 +124,7 @@ bool LLMutex::trylock() return true; } - apr_status_t status(apr_thread_mutex_trylock(mAPRMutexp)); - if (APR_STATUS_IS_EBUSY(status)) + if (!mMutexp->try_lock()) { return false; } @@ -161,44 +143,35 @@ bool LLMutex::trylock() //============================================================================ -LLCondition::LLCondition(apr_pool_t *poolp) : - LLMutex(poolp) +LLCondition::LLCondition() + { // base class (LLMutex) has already ensured that mAPRPoolp is set up. - - apr_thread_cond_create(&mAPRCondp, mAPRPoolp); + mCondp = new std::condition_variable(); } LLCondition::~LLCondition() { - apr_thread_cond_destroy(mAPRCondp); - mAPRCondp = NULL; + delete mCondp; + mCondp = nullptr; } void LLCondition::wait() { - if (!isLocked()) - { //mAPRMutexp MUST be locked before calling apr_thread_cond_wait - apr_thread_mutex_lock(mAPRMutexp); -#if MUTEX_DEBUG - // avoid asserts on destruction in non-release builds - U32 id = LLThread::currentID(); - mIsLocked[id] = TRUE; -#endif - } - apr_thread_cond_wait(mAPRCondp, mAPRMutexp); + std::unique_lock< std::mutex > lock( *mMutexp ); + mCondp->wait( lock ); } void LLCondition::signal() { - apr_thread_cond_signal(mAPRCondp); + mCondp->notify_one() ; } void LLCondition::broadcast() { - apr_thread_cond_broadcast(mAPRCondp); + mCondp->notify_all(); } diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index ea535cee86..566f37c66a 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -29,6 +29,16 @@ #include "stdtypes.h" +#if LL_WINDOWS +#pragma warning(disable:4265) +#endif + +#include +#include + +#if LL_WINDOWS +#pragma warning(default:4265) +#endif //============================================================================ #define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO) @@ -37,9 +47,6 @@ #include #endif -struct apr_thread_mutex_t; -struct apr_pool_t; -struct apr_thread_cond_t; class LL_COMMON_API LLMutex { @@ -49,7 +56,7 @@ public: NO_THREAD = 0xFFFFFFFF } e_locking_thread; - LLMutex(apr_pool_t *apr_poolp = NULL); // NULL pool constructs a new pool for the mutex + LLMutex(); // NULL pool constructs a new pool for the mutex virtual ~LLMutex(); void lock(); // blocks @@ -60,11 +67,10 @@ public: U32 lockingThread() const; //get ID of locking thread protected: - apr_thread_mutex_t *mAPRMutexp; + std::mutex *mMutexp; mutable U32 mCount; mutable U32 mLockingThread; - apr_pool_t *mAPRPoolp; BOOL mIsLocalPool; #if MUTEX_DEBUG @@ -76,7 +82,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(); // Defaults to global pool, could use the thread pool as well. ~LLCondition(); void wait(); // blocks @@ -84,7 +90,7 @@ public: void broadcast(); protected: - apr_thread_cond_t* mAPRCondp; + std::condition_variable* mCondp; }; class LLMutexLock diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 8cef4293cd..8684ff4a87 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -36,10 +36,10 @@ LLQueuedThread::LLQueuedThread(const std::string& name, bool threaded, bool should_pause) : LLThread(name), mThreaded(threaded), - mIdleThread(TRUE), mNextHandle(0), mStarted(FALSE) { + mIdleThread = true; if (mThreaded) { if(should_pause) diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 32e8ea9682..1e68124867 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -183,8 +183,8 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) : mIsLocalPool = TRUE; apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread } - mRunCondition = new LLCondition(mAPRPoolp); - mDataLock = new LLMutex(mAPRPoolp); + mRunCondition = new LLCondition(); + mDataLock = new LLMutex(); mLocalAPRFilePoolp = NULL ; } @@ -409,7 +409,7 @@ void LLThreadSafeRefCount::initThreadSafeRefCount() { if (!sMutex) { - sMutex = new LLMutex(0); + sMutex = new LLMutex(); } } diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index d4af2c6b01..8f33d789eb 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -738,7 +738,7 @@ void LLUUID::getCurrentTime(uuid_time_t *timestamp) getSystemTime(&time_last); uuids_this_tick = uuids_per_tick; init = TRUE; - mMutex = new LLMutex(NULL); + mMutex = new LLMutex(); } uuid_time_t time_now = {0,0}; diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 4c197dc1d6..ca37fa14e4 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -37,7 +37,7 @@ LLWorkerThread::LLWorkerThread(const std::string& name, bool threaded, bool should_pause) : LLQueuedThread(name, threaded, should_pause) { - mDeleteMutex = new LLMutex(NULL); + mDeleteMutex = new LLMutex(); if(!mLocalAPRFilePoolp) { @@ -204,7 +204,6 @@ LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& na mWorkerClassName(name), mRequestHandle(LLWorkerThread::nullHandle()), mRequestPriority(LLWorkerThread::PRIORITY_NORMAL), - mMutex(NULL), mWorkFlags(0) { if (!mWorkerThread) diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp index 1829062af6..7c93c54cdf 100644 --- a/indra/llcorehttp/httpcommon.cpp +++ b/indra/llcorehttp/httpcommon.cpp @@ -333,7 +333,7 @@ LLMutex *getCurlMutex() if (!sHandleMutexp) { - sHandleMutexp = new LLMutex(NULL); + sHandleMutexp = new LLMutex(); } return sHandleMutexp; @@ -389,7 +389,7 @@ void initialize() S32 mutex_count = CRYPTO_num_locks(); for (S32 i = 0; i < mutex_count; i++) { - sSSLMutex.push_back(LLMutex_ptr(new LLMutex(NULL))); + sSSLMutex.push_back(LLMutex_ptr(new LLMutex())); } CRYPTO_set_id_callback(&ssl_thread_id); CRYPTO_set_locking_callback(&ssl_locking_callback); diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 4a76d15096..ab39ef46fa 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -595,7 +595,7 @@ void LLImage::initClass(bool use_new_byte_range, S32 minimal_reverse_byte_range_ { sUseNewByteRange = use_new_byte_range; sMinimalReverseByteRangePercent = minimal_reverse_byte_range_percent; - sMutex = new LLMutex(NULL); + sMutex = new LLMutex(); LLImageBase::createPrivatePool() ; } diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 4875fe7001..5f42fba866 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -35,7 +35,7 @@ LLImageDecodeThread::LLImageDecodeThread(bool threaded) : LLQueuedThread("imagedecode", threaded) { - mCreationMutex = new LLMutex(getAPRPool()); + mCreationMutex = new LLMutex(); } //virtual diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 3b8f08e0c6..0ae7123a6c 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -214,7 +214,7 @@ void LLVolumeMgr::useMutex() { if (!mDataMutex) { - mDataMutex = new LLMutex(gAPRPoolp); + mDataMutex = new LLMutex(); } } diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp index d07d9980c3..1a0eceba0f 100644 --- a/indra/llmessage/llbuffer.cpp +++ b/indra/llmessage/llbuffer.cpp @@ -265,7 +265,7 @@ void LLBufferArray::setThreaded(bool threaded) { if(!mMutexp) { - mMutexp = new LLMutex(NULL); + mMutexp = new LLMutex(); } } else diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index 537efa69d8..d164289c49 100644 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -48,7 +48,6 @@ static void tcp_close_channel(LLSocket::ptr_t* handle_ptr); // Close an open TCP LLProxy::LLProxy(): mHTTPProxyEnabled(false), - mProxyMutex(NULL), mUDPProxy(), mTCPProxy(), mHTTPProxy(), diff --git a/indra/llmessage/llpumpio.h b/indra/llmessage/llpumpio.h index d2c5d37571..3166f80b5b 100644 --- a/indra/llmessage/llpumpio.h +++ b/indra/llmessage/llpumpio.h @@ -394,8 +394,8 @@ protected: S32 mCurrentPoolReallocCount; #if LL_THREADS_APR - apr_thread_mutex_t* mChainsMutex; - apr_thread_mutex_t* mCallbackMutex; + std::mutex* mChainsMutex; + std::mutex* mCallbackMutex; #else int* mChainsMutex; int* mCallbackMutex; diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 9468696507..b78e7d6f66 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -92,8 +92,6 @@ void LLPluginMessagePipeOwner::killMessagePipe(void) } LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket): - mInputMutex(gAPRPoolp), - mOutputMutex(gAPRPoolp), mOutputStartIndex(0), mOwner(owner), mSocket(socket) diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 0a8e58ac90..bcb944097c 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -79,12 +79,11 @@ protected: }; -LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner): - mIncomingQueueMutex(gAPRPoolp) +LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner) { if(!sInstancesMutex) { - sInstancesMutex = new LLMutex(gAPRPoolp); + sInstancesMutex = new LLMutex(); } mOwner = owner; diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index db0eac7031..f60e8b832b 100644 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -234,7 +234,7 @@ LLVFS::LLVFS(const std::string& index_filename, const std::string& data_filename mDataFP(NULL), mIndexFP(NULL) { - mDataMutex = new LLMutex(0); + mDataMutex = new LLMutex(); S32 i; for (i = 0; i < VFSLOCK_COUNT; i++) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 464e216cf0..eb550197b0 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2152,7 +2152,7 @@ bool LLAppViewer::initThreads() if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog) { - LLTrace::BlockTimer::setLogLock(new LLMutex(NULL)); + LLTrace::BlockTimer::setLogLock(new LLMutex()); mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::BlockTimer::sLogName); mFastTimerLogThread->start(); } diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index b48ecc8f31..6926068230 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -46,7 +46,6 @@ LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_i mPageSize(gSavedSettings.getS32("ConversationHistoryPageSize")), mAccountName(session_id[LL_FCP_ACCOUNT_NAME]), mCompleteName(session_id[LL_FCP_COMPLETE_NAME]), - mMutex(NULL), mShowHistory(false), mMessages(NULL), mHistoryThreadsBusy(false), diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index da84a6b8f8..393b1a8225 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -258,7 +258,7 @@ mCalculateBtn(NULL) sInstance = this; mLastMouseX = 0; mLastMouseY = 0; - mStatusLock = new LLMutex(NULL); + mStatusLock = new LLMutex(); mModelPreview = NULL; mLODMode[LLModel::LOD_HIGH] = 0; @@ -1195,7 +1195,7 @@ void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handl //----------------------------------------------------------------------------- LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) -: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL) +: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) , mLodsQuery() , mLodsWithParsingError() , mPelvisZOffset( 0.0f ) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index c535fc1cdf..b1416521d2 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -516,7 +516,7 @@ LLMutex* LLLogChat::historyThreadsMutex() { if (sHistoryThreadsMutex == NULL) { - sHistoryThreadsMutex = new LLMutex(NULL); + sHistoryThreadsMutex = new LLMutex(); } return sHistoryThreadsMutex; } @@ -1012,8 +1012,6 @@ void LLDeleteHistoryThread::run() LLActionThread::LLActionThread(const std::string& name) : LLThread(name), - mMutex(NULL), - mRunCondition(NULL), mFinished(false) { } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index fdaa28b22b..2ba5592c15 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -809,9 +809,9 @@ LLMeshRepoThread::LLMeshRepoThread() { LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); - mMutex = new LLMutex(NULL); - mHeaderMutex = new LLMutex(NULL); - mSignal = new LLCondition(NULL); + mMutex = new LLMutex(); + mHeaderMutex = new LLMutex(); + mSignal = new LLCondition(); mHttpRequest = new LLCore::HttpRequest; mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); mHttpOptions->setTransferTimeout(SMALL_MESH_XFER_TIMEOUT); @@ -1914,7 +1914,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mUploadSkin = upload_skin; mUploadJoints = upload_joints; mLockScaleIfJointPosition = lock_scale_if_joint_position; - mMutex = new LLMutex(NULL); + mMutex = new LLMutex(); mPendingUploads = 0; mFinished = false; mOrigin = gAgent.getPositionAgent(); @@ -3308,7 +3308,7 @@ LLMeshRepository::LLMeshRepository() void LLMeshRepository::init() { - mMeshMutex = new LLMutex(NULL); + mMeshMutex = new LLMutex(); LLConvexDecomposition::getInstance()->initSystem(); @@ -4189,8 +4189,8 @@ LLPhysicsDecomp::LLPhysicsDecomp() mQuitting = false; mDone = false; - mSignal = new LLCondition(NULL); - mMutex = new LLMutex(NULL); + mSignal = new LLCondition(); + mMutex = new LLMutex(); } LLPhysicsDecomp::~LLPhysicsDecomp() diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index dadf2f9701..327744e895 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -825,10 +825,6 @@ void LLTextureCacheWorker::endWork(S32 param, bool aborted) LLTextureCache::LLTextureCache(bool threaded) : LLWorkerThread("TextureCache", threaded), - mWorkersMutex(NULL), - mHeaderMutex(NULL), - mListMutex(NULL), - mFastCacheMutex(NULL), mHeaderAPRFile(NULL), mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called. mTexturesSizeTotal(0), diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 1f7796e6d0..3bf6e71ad4 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -925,7 +925,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mCanUseHTTP(true), mRetryAttempt(0), mActiveCount(0), - mWorkMutex(NULL), mFirstPacket(0), mLastPacket(-1), mTotalPackets(0), @@ -2543,8 +2542,6 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mDebugPause(FALSE), mPacketCount(0), mBadPacketCount(0), - mQueueMutex(getAPRPool()), - mNetworkQueueMutex(getAPRPool()), mTextureCache(cache), mImageDecodeThread(imagedecodethread), mTextureBandwidth(0), diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 90355b7166..bbec8d2282 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -157,7 +157,7 @@ void LLFilePickerThread::run() //static void LLFilePickerThread::initClass() { - sMutex = new LLMutex(NULL); + sMutex = new LLMutex(); } //static diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp index 2782cd9545..5675653f02 100644 --- a/indra/newview/llwatchdog.cpp +++ b/indra/newview/llwatchdog.cpp @@ -185,7 +185,7 @@ void LLWatchdog::init(killer_event_callback func) mKillerCallback = func; if(!mSuspectsAccessMutex && !mTimer) { - mSuspectsAccessMutex = new LLMutex(NULL); + mSuspectsAccessMutex = new LLMutex(); mTimer = new LLWatchdogTimerThread(); mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000); mLastClockCount = LLTimer::getTotalTime();