Make sure that sRunning <= number of threads with status RUNNING.

This commit is contained in:
Aleric Inglewood
2012-05-03 16:32:25 +02:00
parent 5996ff1fa2
commit 0bee4a922f

View File

@@ -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;