diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-06-10 17:06:06 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-06-10 19:25:02 +0300 |
commit | 0dcc912cecdfb365c1f4246545ece40ccb7bc18e (patch) | |
tree | ccf664c765d1adbbf4985069321df65c85ca36e2 /indra/llcorehttp/_httprequestqueue.cpp | |
parent | bd8438f7083643ae5812b14e35e69e69ef1616c6 (diff) | |
parent | d317454c82e016a02c8a708a0118f3ff29aa8e82 (diff) |
Merge main into inventory_favorites
# Conflicts:
# indra/llui/llfolderviewmodel.h
# indra/newview/llpanelwearing.cpp
# indra/newview/llwearableitemslist.cpp
Diffstat (limited to 'indra/llcorehttp/_httprequestqueue.cpp')
-rw-r--r-- | indra/llcorehttp/_httprequestqueue.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/indra/llcorehttp/_httprequestqueue.cpp b/indra/llcorehttp/_httprequestqueue.cpp index ad72bdcce6..df89fb85ec 100644 --- a/indra/llcorehttp/_httprequestqueue.cpp +++ b/indra/llcorehttp/_httprequestqueue.cpp @@ -1,6 +1,6 @@ /** * @file _httprequestqueue.cpp - * @brief + * @brief * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code @@ -39,8 +39,8 @@ HttpRequestQueue * HttpRequestQueue::sInstance(NULL); HttpRequestQueue::HttpRequestQueue() - : RefCounted(true), - mQueueStopped(false) + : RefCounted(true), + mQueueStopped(false) { } @@ -53,99 +53,99 @@ HttpRequestQueue::~HttpRequestQueue() void HttpRequestQueue::init() { - llassert_always(! sInstance); - sInstance = new HttpRequestQueue(); + llassert_always(! sInstance); + sInstance = new HttpRequestQueue(); } void HttpRequestQueue::term() { - if (sInstance) - { - sInstance->release(); - sInstance = NULL; - } + if (sInstance) + { + sInstance->release(); + sInstance = NULL; + } } HttpStatus HttpRequestQueue::addOp(const HttpRequestQueue::opPtr_t &op) { - bool wake(false); - { - HttpScopedLock lock(mQueueMutex); - - if (mQueueStopped) - { - // Return op and error to caller - return HttpStatus(HttpStatus::LLCORE, HE_SHUTTING_DOWN); - } - wake = mQueue.empty(); - mQueue.push_back(op); - } - if (wake) - { - mQueueCV.notify_all(); - } - return HttpStatus(); + bool wake(false); + { + HttpScopedLock lock(mQueueMutex); + + if (mQueueStopped) + { + // Return op and error to caller + return HttpStatus(HttpStatus::LLCORE, HE_SHUTTING_DOWN); + } + wake = mQueue.empty(); + mQueue.push_back(op); + } + if (wake) + { + mQueueCV.notify_all(); + } + return HttpStatus(); } HttpRequestQueue::opPtr_t HttpRequestQueue::fetchOp(bool wait) { - HttpOperation::ptr_t result; + HttpOperation::ptr_t result; - { - HttpScopedLock lock(mQueueMutex); + { + HttpScopedLock lock(mQueueMutex); - while (mQueue.empty()) - { - if (! wait || mQueueStopped) + while (mQueue.empty()) + { + if (! wait || mQueueStopped) return HttpOperation::ptr_t(); - mQueueCV.wait(lock); - } + mQueueCV.wait(lock); + } - result = mQueue.front(); - mQueue.erase(mQueue.begin()); - } + result = mQueue.front(); + mQueue.erase(mQueue.begin()); + } - // Caller also acquires the reference count - return result; + // Caller also acquires the reference count + return result; } void HttpRequestQueue::fetchAll(bool wait, OpContainer & ops) { - // Not valid putting something back on the queue... - llassert_always(ops.empty()); + // Not valid putting something back on the queue... + llassert_always(ops.empty()); - { - HttpScopedLock lock(mQueueMutex); + { + HttpScopedLock lock(mQueueMutex); - while (mQueue.empty()) - { - if (! wait || mQueueStopped) - return; - mQueueCV.wait(lock); - } + while (mQueue.empty()) + { + if (! wait || mQueueStopped) + return; + mQueueCV.wait(lock); + } - mQueue.swap(ops); - } + mQueue.swap(ops); + } - // Caller also acquires the reference counts on each op. - return; + // Caller also acquires the reference counts on each op. + return; } void HttpRequestQueue::wakeAll() { - mQueueCV.notify_all(); + mQueueCV.notify_all(); } bool HttpRequestQueue::stopQueue() { - { - HttpScopedLock lock(mQueueMutex); + { + HttpScopedLock lock(mQueueMutex); if (!mQueueStopped) { @@ -155,7 +155,7 @@ bool HttpRequestQueue::stopQueue() } wakeAll(); return false; - } + } } |