diff options
author | Oz Linden <oz@lindenlab.com> | 2010-12-02 14:08:23 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2010-12-02 14:08:23 -0500 |
commit | 375d91019eefa0f2bc4f4685fb0f34dac987b189 (patch) | |
tree | c4bbed389b33de9dc8fbc746bccccb6545307ad6 /indra/llcommon | |
parent | 732b1f748eb1844eb97ab2293ebc3b1bebb0c9e7 (diff) | |
parent | 20e192029ceaf7e9b6d097d6e65089d9011a4c0b (diff) |
merge fix for STORM-679
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llthread.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 148aaf8aed..49d05ef411 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -63,9 +63,6 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap { LLThread *threadp = (LLThread *)datap; - // Set thread state to running - threadp->mStatus = RUNNING; - // Run the user supplied function threadp->run(); @@ -167,10 +164,25 @@ void LLThread::shutdown() void LLThread::start() { - apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp); + llassert(isStopped()); + + // Set thread state to running + mStatus = RUNNING; - // We won't bother joining - apr_thread_detach(mAPRThreadp); + apr_status_t status = + apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp); + + if(status == APR_SUCCESS) + { + // We won't bother joining + apr_thread_detach(mAPRThreadp); + } + else + { + mStatus = STOPPED; + llwarns << "failed to start thread " << mName << llendl; + ll_apr_warn_status(status); + } } //============================================================================ |