diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-07-19 10:47:11 +0300 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-07-20 20:32:48 +0300 |
| commit | ce21ab1950b685b84ba0651d51cc4c200763860c (patch) | |
| tree | 86b4226dc4163ec01a55a00ca8d56be784a00cc6 /indra/llcommon/llthread.cpp | |
| parent | 331c3c758a114d23950ab23bb94ee19e85e662dd (diff) | |
#6014 Reduce shutdown delays on thread cleanup
Diffstat (limited to 'indra/llcommon/llthread.cpp')
| -rw-r--r-- | indra/llcommon/llthread.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 8c12ee7f12..4f15626108 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -314,11 +314,13 @@ void LLThread::shutdown() // The thread isn't already stopped // First, set the flag that indicates that we're ready to die setQuitting(); + if (!isStopped()) + { + // Give the thread a chance to update status. + yield(); + } //LL_INFOS() << "LLThread::~LLThread() Killing thread " << mName << " Status: " << mStatus << LL_ENDL; - // Now wait a bit for the thread to exit - // It's unclear whether I should even bother doing this - this destructor - // should never get called unless we're already stopped, really... S32 counter = 0; const S32 MAX_WAIT = 600; while (counter < MAX_WAIT) @@ -327,9 +329,9 @@ void LLThread::shutdown() { break; } - // Sleep for a tenth of a second - ms_sleep(100); - yield(); + // Sleep for 10ms, 6 seconds total, then give up and kill the thread + // Warning: This can be called from the main thread + ms_sleep(10); counter++; } } |
