From 0bee4a922f2bc84796d901f83766ecfe162f0f2a Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Thu, 3 May 2012 16:32:25 +0200 Subject: [PATCH] Make sure that sRunning <= number of threads with status RUNNING. --- indra/llcommon/llthread.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 4088d4a44..6f07b5482 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -104,6 +104,11 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap // the moment it happens... therefore make a copy here. char const* volatile name = threadp->mName.c_str(); + // Always make sure that sRunning <= number of threads with status RUNNING, + // so do this before changing mStatus (meaning that once we see that we + // are STOPPED, then sRunning is also up to date). + --sRunning; + // We're done with the run function, this thread is done executing now. threadp->mStatus = STOPPED;