From 500587a04bf3a8793e8f32fe397e0b4e469aedb4 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 23 Sep 2026 16:28:04 -0700 Subject: Issue #6367: The viewer would hang on exit if still connected to a plugin. Updates how the viewer dispatches coroutines to the main thread and removes an extraneous wait, that was incorrectly serializing asynchronous messages. --- indra/llcommon/workqueue.cpp | 6 ++++++ indra/llcommon/workqueue.h | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/workqueue.cpp b/indra/llcommon/workqueue.cpp index fbd92d089e..4f19ab2cc2 100644 --- a/indra/llcommon/workqueue.cpp +++ b/indra/llcommon/workqueue.cpp @@ -319,6 +319,12 @@ bool LL::WorkQueue::tryPost(const Work& callable) } } +bool LL::WorkQueue::postToMainLoop(const Work& work) +{ + auto queue = getInstance("mainloop"); + return queue && queue->tryPost(work); +} + LL::WorkQueue::Work LL::WorkQueue::pop_() { return mQueue.pop(); diff --git a/indra/llcommon/workqueue.h b/indra/llcommon/workqueue.h index 69f3286c1b..322baa36e6 100644 --- a/indra/llcommon/workqueue.h +++ b/indra/llcommon/workqueue.h @@ -265,6 +265,16 @@ namespace LL */ bool tryPost(const Work&) override; + /** + * @brief Post work to the well-known main-loop queue without blocking + * @return true if posted, false if the main loop is gone or its + * queue is closed/full + * + * For callers on a secondary thread that must not block waiting for + * the main thread (e.g. a websocket I/O thread). + */ + static bool postToMainLoop(const Work& work); + private: using Queue = LLThreadSafeQueue; Queue mQueue; -- cgit v1.3