b782a75c99e6 backout cleanup
parent
c0ca8e5e2e
commit
4924f0c99b
|
|
@ -1325,7 +1325,7 @@ LLPrivateMemoryPool::LLPrivateMemoryPool(S32 type, U32 max_pool_size) :
|
|||
{
|
||||
if(type == STATIC_THREADED || type == VOLATILE_THREADED)
|
||||
{
|
||||
mMutexp = new LLMutex ;
|
||||
mMutexp = new LLMutex(NULL) ;
|
||||
}
|
||||
|
||||
for(S32 i = 0 ; i < SUPER_ALLOCATION ; i++)
|
||||
|
|
|
|||
|
|
@ -36,12 +36,6 @@
|
|||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#if !LL_DARWIN
|
||||
U32 ll_thread_local local_thread_ID = 0;
|
||||
#endif
|
||||
|
||||
U32 LLThread::sIDIter = 0;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Usage:
|
||||
// void run_func(LLThread* thread)
|
||||
|
|
@ -62,6 +56,12 @@ U32 LLThread::sIDIter = 0;
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#if !LL_DARWIN
|
||||
U32 ll_thread_local sThreadID = 0;
|
||||
#endif
|
||||
|
||||
U32 LLThread::sIDIter = 0;
|
||||
|
||||
LL_COMMON_API void assert_main_thread()
|
||||
{
|
||||
static U32 s_thread_id = LLThread::currentID();
|
||||
|
|
@ -79,7 +79,7 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
|
|||
LLThread *threadp = (LLThread *)datap;
|
||||
|
||||
#if !LL_DARWIN
|
||||
local_thread_ID = threadp->mID;
|
||||
sThreadID = threadp->mID;
|
||||
#endif
|
||||
|
||||
// Run the user supplied function
|
||||
|
|
@ -100,6 +100,8 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
|
|||
mAPRThreadp(NULL),
|
||||
mStatus(STOPPED)
|
||||
{
|
||||
mID = ++sIDIter;
|
||||
|
||||
// Thread creation probably CAN be paranoid about APR being initialized, if necessary
|
||||
if (poolp)
|
||||
{
|
||||
|
|
@ -162,7 +164,7 @@ void LLThread::shutdown()
|
|||
if (!isStopped())
|
||||
{
|
||||
// This thread just wouldn't stop, even though we gave it time
|
||||
//llwarns << "LLThread::shutdown() exiting thread before clean exit!" << llendl;
|
||||
//llwarns << "LLThread::~LLThread() exiting thread before clean exit!" << llendl;
|
||||
// Put a stake in its heart.
|
||||
apr_thread_exit(mAPRThreadp, -1);
|
||||
return;
|
||||
|
|
@ -302,7 +304,7 @@ void LLThread::wakeLocked()
|
|||
//============================================================================
|
||||
|
||||
LLMutex::LLMutex(apr_pool_t *poolp) :
|
||||
mAPRMutexp(NULL)
|
||||
mAPRMutexp(NULL), mCount(0), mLockingThread(NO_THREAD)
|
||||
{
|
||||
//if (poolp)
|
||||
//{
|
||||
|
|
@ -321,7 +323,8 @@ LLMutex::LLMutex(apr_pool_t *poolp) :
|
|||
LLMutex::~LLMutex()
|
||||
{
|
||||
#if MUTEX_DEBUG
|
||||
llassert_always(!isLocked()); // better not be locked!
|
||||
//bad assertion, the subclass LLSignal might be "locked", and that's OK
|
||||
//llassert_always(!isLocked()); // better not be locked!
|
||||
#endif
|
||||
apr_thread_mutex_destroy(mAPRMutexp);
|
||||
mAPRMutexp = NULL;
|
||||
|
|
@ -334,7 +337,18 @@ LLMutex::~LLMutex()
|
|||
|
||||
void LLMutex::lock()
|
||||
{
|
||||
#if LL_DARWIN
|
||||
if (mLockingThread == LLThread::currentID())
|
||||
#else
|
||||
if (mLockingThread == sThreadID)
|
||||
#endif
|
||||
{ //redundant lock
|
||||
mCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
apr_thread_mutex_lock(mAPRMutexp);
|
||||
|
||||
#if MUTEX_DEBUG
|
||||
// Have to have the lock before we can access the debug info
|
||||
U32 id = LLThread::currentID();
|
||||
|
|
@ -342,10 +356,22 @@ void LLMutex::lock()
|
|||
llerrs << "Already locked in Thread: " << id << llendl;
|
||||
mIsLocked[id] = TRUE;
|
||||
#endif
|
||||
|
||||
#if LL_DARWIN
|
||||
mLockingThread = LLThread::currentID();
|
||||
#else
|
||||
mLockingThread = sThreadID;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLMutex::unlock()
|
||||
{
|
||||
if (mCount > 0)
|
||||
{ //not the root unlock
|
||||
mCount--;
|
||||
return;
|
||||
}
|
||||
|
||||
#if MUTEX_DEBUG
|
||||
// Access the debug info while we have the lock
|
||||
U32 id = LLThread::currentID();
|
||||
|
|
@ -353,6 +379,8 @@ void LLMutex::unlock()
|
|||
llerrs << "Not locked in Thread: " << id << llendl;
|
||||
mIsLocked[id] = FALSE;
|
||||
#endif
|
||||
|
||||
mLockingThread = NO_THREAD;
|
||||
apr_thread_mutex_unlock(mAPRMutexp);
|
||||
}
|
||||
|
||||
|
|
@ -370,6 +398,11 @@ bool LLMutex::isLocked()
|
|||
}
|
||||
}
|
||||
|
||||
U32 LLMutex::lockingThread() const
|
||||
{
|
||||
return mLockingThread;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
LLCondition::LLCondition(apr_pool_t *poolp) :
|
||||
|
|
@ -390,6 +423,15 @@ LLCondition::~LLCondition()
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -404,44 +446,6 @@ void LLCondition::broadcast()
|
|||
}
|
||||
|
||||
//============================================================================
|
||||
LLMutexBase::LLMutexBase() :
|
||||
mLockingThread(NO_THREAD),
|
||||
mCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
void LLMutexBase::lock()
|
||||
{
|
||||
#if LL_DARWIN
|
||||
if (mLockingThread == LLThread::currentID())
|
||||
#else
|
||||
if (mLockingThread == local_thread_ID)
|
||||
#endif
|
||||
{ //redundant lock
|
||||
mCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
apr_thread_mutex_lock(mAPRMutexp);
|
||||
|
||||
#if LL_DARWIN
|
||||
mLockingThread = LLThread::currentID();
|
||||
#else
|
||||
mLockingThread = local_thread_ID;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLMutexBase::unlock()
|
||||
{
|
||||
if (mCount > 0)
|
||||
{ //not the root unlock
|
||||
mCount--;
|
||||
return;
|
||||
}
|
||||
mLockingThread = NO_THREAD;
|
||||
|
||||
apr_thread_mutex_unlock(mAPRMutexp);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ public:
|
|||
apr_pool_t *getAPRPool() { return mAPRPoolp; }
|
||||
LLVolatileAPRPool* getLocalAPRFilePool() { return mLocalAPRFilePoolp ; }
|
||||
|
||||
U32 getID() const { return mID; }
|
||||
|
||||
private:
|
||||
BOOL mPaused;
|
||||
|
||||
|
|
@ -101,7 +103,7 @@ protected:
|
|||
BOOL mIsLocalPool;
|
||||
EThreadStatus mStatus;
|
||||
U32 mID;
|
||||
|
||||
|
||||
//a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used.
|
||||
//Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes.
|
||||
// otherwise it will cause severe memory leaking!!! --bao
|
||||
|
|
@ -138,17 +140,27 @@ protected:
|
|||
class LL_COMMON_API LLMutex
|
||||
{
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
NO_THREAD = 0xFFFFFFFF
|
||||
} e_locking_thread;
|
||||
|
||||
LLMutex(apr_pool_t *apr_poolp); // NULL pool constructs a new pool for the mutex
|
||||
virtual ~LLMutex();
|
||||
|
||||
void lock(); // blocks
|
||||
void unlock();
|
||||
bool isLocked(); // non-blocking, but does do a lock/unlock so not free
|
||||
U32 lockingThread() const; //get ID of locking thread
|
||||
|
||||
protected:
|
||||
apr_thread_mutex_t *mAPRMutexp;
|
||||
mutable U32 mCount;
|
||||
mutable U32 mLockingThread;
|
||||
|
||||
apr_pool_t *mAPRPoolp;
|
||||
BOOL mIsLocalPool;
|
||||
|
||||
#if MUTEX_DEBUG
|
||||
std::map<U32, BOOL> mIsLocked;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "linden_common.h"
|
||||
|
||||
#include "llimagedxt.h"
|
||||
#include "llmemory.h"
|
||||
|
||||
//static
|
||||
void LLImageDXT::checkMinWidthHeight(EFileFormat format, S32& width, S32& height)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "llmemtype.h"
|
||||
#include "lltimer.h"
|
||||
#include "llmath.h"
|
||||
#include "llmemory.h"
|
||||
|
||||
typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)();
|
||||
typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*);
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ LLCurl::Multi::Multi()
|
|||
mThreaded = LLCurl::sMultiThreaded && LLThread::currentID() == sMainThreadID;
|
||||
if (mThreaded)
|
||||
{
|
||||
mSignal = new LLCondition();
|
||||
mSignal = new LLCondition(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1189,8 +1189,8 @@ void LLCurl::initClass(bool multi_threaded)
|
|||
|
||||
check_curl_code(code);
|
||||
|
||||
Easy::sHandleMutex = new LLMutex();
|
||||
Easy::sMultiMutex = new LLMutex();
|
||||
Easy::sHandleMutex = new LLMutex(NULL);
|
||||
Easy::sMultiMutex = new LLMutex(NULL);
|
||||
|
||||
#if SAFE_SSL
|
||||
S32 mutex_count = CRYPTO_num_locks();
|
||||
|
|
|
|||
|
|
@ -145,12 +145,6 @@ public:
|
|||
*/
|
||||
apr_socket_t* getSocket() const { return mSocket; }
|
||||
|
||||
/**
|
||||
* @brief Protected constructor since should only make sockets
|
||||
* with one of the two <code>create()</code> calls.
|
||||
*/
|
||||
LLSocket(apr_socket_t* socket, apr_pool_t* pool);
|
||||
|
||||
/**
|
||||
* @brief Set default socket options, with SO_NONBLOCK = 0 and a timeout in us.
|
||||
* @param timeout Number of microseconds to wait on this socket. Any
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static void tcp_close_channel(LLSocket::ptr_t* handle_ptr); // Close an open TCP
|
|||
|
||||
LLProxy::LLProxy():
|
||||
mHTTPProxyEnabled(false),
|
||||
mProxyMutex(),
|
||||
mProxyMutex(NULL),
|
||||
mUDPProxy(),
|
||||
mTCPProxy(),
|
||||
mHTTPProxy(),
|
||||
|
|
@ -524,7 +524,7 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou
|
|||
*/
|
||||
static LLSocket::ptr_t tcp_open_channel(LLHost host)
|
||||
{
|
||||
LLSocket::ptr_t socket = LLSocket::create(LLSocket::STREAM_TCP);
|
||||
LLSocket::ptr_t socket = LLSocket::create(NULL, LLSocket::STREAM_TCP);
|
||||
bool connected = socket->blockingConnect(host);
|
||||
if (!connected)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ mCalculateBtn(NULL)
|
|||
mLastMouseX = 0;
|
||||
mLastMouseY = 0;
|
||||
mGLName = 0;
|
||||
mStatusLock = new LLMutex();
|
||||
mStatusLock = new LLMutex(NULL);
|
||||
mModelPreview = NULL;
|
||||
|
||||
mLODMode[LLModel::LOD_HIGH] = 0;
|
||||
|
|
@ -3077,7 +3077,7 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
|
||||
: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex()
|
||||
: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL)
|
||||
, mPelvisZOffset( 0.0f )
|
||||
, mLegacyRigValid( false )
|
||||
, mRigValidJointUpload( false )
|
||||
|
|
|
|||
|
|
@ -447,9 +447,9 @@ LLMeshRepoThread::LLMeshRepoThread()
|
|||
: LLThread("mesh repo")
|
||||
{
|
||||
mWaiting = false;
|
||||
mMutex = new LLMutex();
|
||||
mHeaderMutex = new LLMutex();
|
||||
mSignal = new LLCondition();
|
||||
mMutex = new LLMutex(NULL);
|
||||
mHeaderMutex = new LLMutex(NULL);
|
||||
mSignal = new LLCondition(NULL);
|
||||
}
|
||||
|
||||
LLMeshRepoThread::~LLMeshRepoThread()
|
||||
|
|
@ -1198,7 +1198,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data,
|
|||
mUploadTextures = upload_textures;
|
||||
mUploadSkin = upload_skin;
|
||||
mUploadJoints = upload_joints;
|
||||
mMutex = new LLMutex();
|
||||
mMutex = new LLMutex(NULL);
|
||||
mCurlRequest = NULL;
|
||||
mPendingUploads = 0;
|
||||
mFinished = false;
|
||||
|
|
@ -2043,7 +2043,7 @@ LLMeshRepository::LLMeshRepository()
|
|||
|
||||
void LLMeshRepository::init()
|
||||
{
|
||||
mMeshMutex = new LLMutex();
|
||||
mMeshMutex = new LLMutex(NULL);
|
||||
|
||||
LLConvexDecomposition::getInstance()->initSystem();
|
||||
|
||||
|
|
@ -2866,8 +2866,8 @@ LLPhysicsDecomp::LLPhysicsDecomp()
|
|||
mQuitting = false;
|
||||
mDone = false;
|
||||
|
||||
mSignal = new LLCondition();
|
||||
mMutex = new LLMutex();
|
||||
mSignal = new LLCondition(NULL);
|
||||
mMutex = new LLMutex(NULL);
|
||||
}
|
||||
|
||||
LLPhysicsDecomp::~LLPhysicsDecomp()
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
// Included to allow LLTextureCache::purgeTextures() to pause watchdog timeout
|
||||
#include "llappviewer.h"
|
||||
#include "llmemory.h"
|
||||
|
||||
// Cache organization:
|
||||
// cache/texture.entries
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ void LLFilePickerThread::run()
|
|||
//static
|
||||
void LLFilePickerThread::initClass()
|
||||
{
|
||||
sMutex = new LLMutex();
|
||||
sMutex = new LLMutex(NULL);
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
|
|||
Loading…
Reference in New Issue