diff --git a/indra/llcommon/aithreadsafe.h b/indra/llcommon/aithreadsafe.h index 425741601..461bb4cc5 100644 --- a/indra/llcommon/aithreadsafe.h +++ b/indra/llcommon/aithreadsafe.h @@ -106,9 +106,9 @@ // on a compiler that doesn't need this hack. #define AI_NEED_ACCESS_CC (defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) || (__GNUC__ < 4))) -template struct AIReadAccessConst; -template struct AIReadAccess; -template struct AIWriteAccess; +template struct AIReadAccessConst; +template struct AIReadAccess; +template struct AIWriteAccess; template struct AIAccessConst; template struct AIAccess; template struct AISTAccessConst; @@ -225,17 +225,17 @@ protected: * * */ -template +template class AIThreadSafe : public AIThreadSafeBits { protected: // Only these may access the object (through ptr()). - friend struct AIReadAccessConst; - friend struct AIReadAccess; - friend struct AIWriteAccess; + friend struct AIReadAccessConst; + friend struct AIReadAccess; + friend struct AIWriteAccess; // Locking control. - AIRWLock mRWLock; + RWLOCK mRWLock; // For use by AIThreadSafeDC AIThreadSafe(void) { } @@ -310,20 +310,20 @@ public: * * which is not possible with AITHREADSAFE. */ -template -class AIThreadSafeDC : public AIThreadSafe +template +class AIThreadSafeDC : public AIThreadSafe { public: // Construct a wrapper around a default constructed object. - AIThreadSafeDC(void) { new (AIThreadSafe::ptr()) T; } + AIThreadSafeDC(void) { new (AIThreadSafe::ptr()) T; } // Allow an arbitrary parameter to be passed for construction. - template AIThreadSafeDC(T2 const& val) { new (AIThreadSafe::ptr()) T(val); } + template AIThreadSafeDC(T2 const& val) { new (AIThreadSafe::ptr()) T(val); } }; /** * @brief Read lock object and provide read access. */ -template +template struct AIReadAccessConst { //! Internal enum for the lock-type of the AI*Access object. @@ -336,8 +336,8 @@ struct AIReadAccessConst }; //! Construct a AIReadAccessConst from a constant AIThreadSafe. - AIReadAccessConst(AIThreadSafe const& wrapper, bool high_priority = false) - : mWrapper(const_cast&>(wrapper)), + AIReadAccessConst(AIThreadSafe const& wrapper, bool high_priority = false) + : mWrapper(const_cast&>(wrapper)), mState(readlocked) #if AI_NEED_ACCESS_CC , mIsCopyConstructed(false) @@ -369,14 +369,14 @@ struct AIReadAccessConst protected: //! Constructor used by AIReadAccess. - AIReadAccessConst(AIThreadSafe& wrapper, state_type state) + AIReadAccessConst(AIThreadSafe& wrapper, state_type state) : mWrapper(wrapper), mState(state) #if AI_NEED_ACCESS_CC , mIsCopyConstructed(false) #endif { } - AIThreadSafe& mWrapper; //!< Reference to the object that we provide access to. + AIThreadSafe& mWrapper; //!< Reference to the object that we provide access to. state_type const mState; //!< The lock state that mWrapper is in. #if AI_NEED_ACCESS_CC @@ -393,39 +393,39 @@ private: /** * @brief Read lock object and provide read access, with possible promotion to write access. */ -template -struct AIReadAccess : public AIReadAccessConst +template +struct AIReadAccess : public AIReadAccessConst { - typedef typename AIReadAccessConst::state_type state_type; - using AIReadAccessConst::readlocked; + typedef typename AIReadAccessConst::state_type state_type; + using AIReadAccessConst::readlocked; //! Construct a AIReadAccess from a non-constant AIThreadSafe. - AIReadAccess(AIThreadSafe& wrapper, bool high_priority = false) : AIReadAccessConst(wrapper, readlocked) { this->mWrapper.mRWLock.rdlock(high_priority); } + AIReadAccess(AIThreadSafe& wrapper, bool high_priority = false) : AIReadAccessConst(wrapper, readlocked) { this->mWrapper.mRWLock.rdlock(high_priority); } protected: //! Constructor used by AIWriteAccess. - AIReadAccess(AIThreadSafe& wrapper, state_type state) : AIReadAccessConst(wrapper, state) { } + AIReadAccess(AIThreadSafe& wrapper, state_type state) : AIReadAccessConst(wrapper, state) { } - friend struct AIWriteAccess; + friend struct AIWriteAccess; }; /** * @brief Write lock object and provide read/write access. */ -template -struct AIWriteAccess : public AIReadAccess +template +struct AIWriteAccess : public AIReadAccess { - using AIReadAccessConst::readlocked; - using AIReadAccessConst::read2writelocked; - using AIReadAccessConst::writelocked; - using AIReadAccessConst::write2writelocked; + using AIReadAccessConst::readlocked; + using AIReadAccessConst::read2writelocked; + using AIReadAccessConst::writelocked; + using AIReadAccessConst::write2writelocked; //! Construct a AIWriteAccess from a non-constant AIThreadSafe. - AIWriteAccess(AIThreadSafe& wrapper) : AIReadAccess(wrapper, writelocked) { this->mWrapper.mRWLock.wrlock();} + AIWriteAccess(AIThreadSafe& wrapper) : AIReadAccess(wrapper, writelocked) { this->mWrapper.mRWLock.wrlock();} //! Promote read access to write access. - explicit AIWriteAccess(AIReadAccess& access) - : AIReadAccess(access.mWrapper, (access.mState == readlocked) ? read2writelocked : write2writelocked) + explicit AIWriteAccess(AIReadAccess& access) + : AIReadAccess(access.mWrapper, (access.mState == readlocked) ? read2writelocked : write2writelocked) { if (this->mState == read2writelocked) {