diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 984e90f37627116b3f7eb9f2b7ad132c280d830a..a2233692c63f7ecc6e13bd59db38597dfa532464 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -151,7 +151,7 @@ LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size //create mutex if(!is_local) //not a local apr_pool, that is: shared by multiple threads. { - mMutexp.reset(new std::mutex()); + mMutexp = std::make_unique<absl::Mutex>(); } } @@ -172,7 +172,7 @@ apr_pool_t* LLVolatileAPRPool::getAPRPool() apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool() { - LLScopedLock lock(mMutexp.get()) ; + absl::MutexLockMaybe lock(mMutexp.get()) ; mNumTotalRef++ ; mNumActiveRef++ ; @@ -187,7 +187,7 @@ apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool() void LLVolatileAPRPool::clearVolatileAPRPool() { - LLScopedLock lock(mMutexp.get()); + absl::MutexLockMaybe lock(mMutexp.get()); if(mNumActiveRef > 0) { diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 255b50c8d04516d3e3da19c77c2dd4766346639a..7de47914783cf3246219066f7a249fa463430cee 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -41,7 +41,7 @@ #include "llstring.h" -#include "mutex.h" +#include "absl/synchronization/mutex.h" struct apr_dso_handle_t; /** @@ -117,7 +117,7 @@ class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool 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. - std::unique_ptr<std::mutex> mMutexp; + std::unique_ptr<absl::Mutex> mMutexp; } ; // File IO convenience functions. diff --git a/indra/llcommon/llmutex.cpp b/indra/llcommon/llmutex.cpp index f32aaad1df12ab54c39a81518fec076c5812344b..70655a433372f847587bdfe4de91df0053201761 100644 --- a/indra/llcommon/llmutex.cpp +++ b/indra/llcommon/llmutex.cpp @@ -182,36 +182,4 @@ LLMutexTrylock::~LLMutexTrylock() mMutex->unlock(); } - -//--------------------------------------------------------------------- -// -// LLScopedLock -// -LLScopedLock::LLScopedLock(std::mutex* mutex) : mMutex(mutex) -{ - if(mutex) - { - mutex->lock(); - mLocked = true; - } - else - { - mLocked = false; - } -} - -LLScopedLock::~LLScopedLock() -{ - unlock(); -} - -void LLScopedLock::unlock() -{ - if(mLocked) - { - mMutex->unlock(); - mLocked = false; - } -} - //============================================================================ diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index dd09cc10c5ec8e733ea5ad1f76d2afcfd627f4e3..ec2166d36869f327ea67821c9b3071f5ae837183 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -29,7 +29,6 @@ #include "stdtypes.h" #include "llthread.h" -#include <boost/noncopyable.hpp> #include "absl/synchronization/mutex.h" @@ -187,46 +186,6 @@ namespace llthread }; } - -/** -* @class LLScopedLock -* @brief Small class to help lock and unlock mutexes. -* -* The constructor handles the lock, and the destructor handles -* the unlock. Instances of this class are <b>not</b> thread safe. -*/ -class LL_COMMON_API LLScopedLock : private boost::noncopyable -{ -public: - /** - * @brief Constructor which accepts a mutex, and locks it. - * - * @param mutex An allocated mutex. If you pass in NULL, - * this wrapper will not lock. - */ - LLScopedLock(std::mutex* mutex); - - /** - * @brief Destructor which unlocks the mutex if still locked. - */ - ~LLScopedLock(); - - /** - * @brief Check lock. - */ - bool isLocked() const { return mLocked; } - - /** - * @brief This method unlocks the mutex. - */ - void unlock(); - -protected: - bool mLocked; - std::mutex* mMutex; -}; - - class AbslMutexMaybeTrylock { public: