From 83fb898852dd6b0ccc9b0e3ce213601dc61394da Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Sun, 3 Feb 2013 17:24:26 +0100 Subject: [PATCH] Bug fix: Wake up curl thread at exit of viewer. --- indra/llmessage/aicurlthread.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/indra/llmessage/aicurlthread.cpp b/indra/llmessage/aicurlthread.cpp index efb5ca46b..c732c9226 100644 --- a/indra/llmessage/aicurlthread.cpp +++ b/indra/llmessage/aicurlthread.cpp @@ -841,10 +841,7 @@ class AICurlThread : public LLThread virtual ~AICurlThread(); // MAIN-THREAD - void wakeup_thread(void); - - // MAIN-THREAD - void stop_thread(void) { mRunning = false; wakeup_thread(); } + void wakeup_thread(bool stop_thread = false); // MAIN-THREAD apr_status_t join_thread(void); @@ -1071,7 +1068,7 @@ void AICurlThread::cleanup_wakeup_fds(void) } // MAIN-THREAD -void AICurlThread::wakeup_thread(void) +void AICurlThread::wakeup_thread(bool stop_thread) { DoutEntering(dc::curl, "AICurlThread::wakeup_thread"); llassert(is_main_thread()); @@ -1080,6 +1077,10 @@ void AICurlThread::wakeup_thread(void) if (!mRunning) return; + // Last time we are run? + if (stop_thread) + mRunning = false; + // Try if curl thread is still awake and if so, pass the new commands directly. if (mWakeUpMutex.tryLock()) { @@ -1857,7 +1858,7 @@ void stopCurlThread(void) using curlthread::AICurlThread; if (AICurlThread::sInstance) { - AICurlThread::sInstance->stop_thread(); + AICurlThread::sInstance->wakeup_thread(true); int count = 401; while(--count && !AICurlThread::sInstance->isStopped()) {