summaryrefslogtreecommitdiff
path: root/indra/llmessage/llcurl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage/llcurl.cpp')
-rw-r--r--indra/llmessage/llcurl.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 14e169c6b1..6d9213f51b 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -222,7 +222,7 @@ namespace boost
std::set<CURL*> LLCurl::Easy::sFreeHandles;
std::set<CURL*> LLCurl::Easy::sActiveHandles;
LLMutex* LLCurl::Easy::sHandleMutex = NULL;
-
+LLMutex* LLCurl::Easy::sMultiMutex = NULL;
//static
CURL* LLCurl::Easy::allocEasyHandle()
@@ -553,6 +553,11 @@ LLCurl::Multi::~Multi()
{
llassert(isStopped());
+ if (LLCurl::sMultiThreaded)
+ {
+ LLCurl::Easy::sMultiMutex->lock();
+ }
+
delete mSignal;
mSignal = NULL;
@@ -573,6 +578,11 @@ LLCurl::Multi::~Multi()
check_curl_multi_code(curl_multi_cleanup(mCurlMultiHandle));
--gCurlMultiCount;
+
+ if (LLCurl::sMultiThreaded)
+ {
+ LLCurl::Easy::sMultiMutex->unlock();
+ }
}
CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue)
@@ -606,6 +616,7 @@ void LLCurl::Multi::run()
mPerformState = PERFORM_STATE_PERFORMING;
if (!mQuitting)
{
+ LLMutexLock lock(LLCurl::Easy::sMultiMutex);
doPerform();
}
}
@@ -1179,6 +1190,7 @@ void LLCurl::initClass(bool multi_threaded)
check_curl_code(code);
Easy::sHandleMutex = new LLMutex();
+ Easy::sMultiMutex = new LLMutex();
#if SAFE_SSL
S32 mutex_count = CRYPTO_num_locks();
@@ -1200,6 +1212,8 @@ void LLCurl::cleanupClass()
delete Easy::sHandleMutex;
Easy::sHandleMutex = NULL;
+ delete Easy::sMultiMutex;
+ Easy::sMultiMutex = NULL;
for (std::set<CURL*>::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter)
{