Added a thread-safe and robust wrapper for APR pools.

See http://redmine.imprudenceviewer.org/issues/590
and https://jira.secondlife.com/browse/SNOW-596
This commit is contained in:
Aleric Inglewood
2011-05-05 01:34:00 +02:00
parent 5b08560047
commit 4d932d5e2d
57 changed files with 895 additions and 751 deletions

View File

@@ -857,7 +857,7 @@ bool LLAppViewer::mainLoop()
//-------------------------------------------
// Create IO Pump to use for HTTP Requests.
gServicePump = new LLPumpIO(gAPRPoolp);
gServicePump = new LLPumpIO;
LLHTTPClient::setPump(*gServicePump);
LLCurl::setCAFile(gDirUtilp->getCAFile());

View File

@@ -139,6 +139,7 @@ int main( int argc, char **argv )
}
delete viewer_app_ptr;
viewer_app_ptr = NULL;
return 0;
}

View File

@@ -119,6 +119,7 @@ int main( int argc, char **argv )
}
delete viewer_app_ptr;
viewer_app_ptr = NULL;
return 0;
}

View File

@@ -68,8 +68,7 @@ LLConsole::LLConsole(const std::string& name, const LLRect &rect,
mFadeTime(persist_time - FADE_DURATION),
mFont(LLFontGL::getFontSansSerif()),
mConsoleWidth(0),
mConsoleHeight(0),
mQueueMutex(NULL)
mConsoleHeight(0)
{
mTimer.reset();

View File

@@ -743,9 +743,6 @@ void LLTextureCacheWorker::endWork(S32 param, bool aborted)
LLTextureCache::LLTextureCache(bool threaded)
: LLWorkerThread("TextureCache", threaded),
mWorkersMutex(NULL),
mHeaderMutex(NULL),
mListMutex(NULL),
mHeaderAPRFile(NULL),
mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
mTexturesSizeTotal(0),

View File

@@ -143,9 +143,6 @@ protected:
std::string getTextureFileName(const LLUUID& id);
void addCompleted(Responder* responder, bool success);
protected:
//void setFileAPRPool(apr_pool_t* pool) { mFileAPRPool = pool ; }
private:
void setDirNames(ELLPath location);
void readHeaderCache();

View File

@@ -425,7 +425,7 @@ class SGHostBlackList{
static void lock() {
if (!sMutex)
sMutex = new LLMutex(0);
sMutex = new LLMutex;
sMutex->lock();
}
@@ -767,7 +767,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,
mRetryAttempt(0),
mActiveCount(0),
mGetStatus(0),
mWorkMutex(NULL),
mFirstPacket(0),
mLastPacket(-1),
mTotalPackets(0),
@@ -1943,8 +1942,6 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
mDebugPause(FALSE),
mPacketCount(0),
mBadPacketCount(0),
mQueueMutex(getAPRPool()),
mNetworkQueueMutex(getAPRPool()),
mTextureCache(cache),
mImageDecodeThread(imagedecodethread),
mTextureBandwidth(0),

View File

@@ -164,7 +164,7 @@
#include "llinstantmessage.h"
#include "llinvite.h"
//#include "llloginflags.h"
#include "llmail.h"
//#include "llmail.h"
#include "llmessagethrottle.h"
#include "llnamevalue.h"
#include "llpacketack.h"

View File

@@ -1781,7 +1781,7 @@ void LLVoiceClient::stateMachine()
if(!mSocket)
{
mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);
mSocket = LLSocket::create(LLSocket::STREAM_TCP);
}
mConnected = mSocket->blockingConnect(mDaemonHost);

View File

@@ -184,8 +184,8 @@ void LLWatchdog::init(killer_event_callback func)
mKillerCallback = func;
if(!mSuspectsAccessMutex && !mTimer)
{
mSuspectsAccessMutex = new LLMutex(NULL);
mTimer = new LLWatchdogTimerThread();
mSuspectsAccessMutex = new LLMutex;
mTimer = new LLWatchdogTimerThread;
mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000);
mLastClockCount = LLTimer::getTotalTime();