diff options
author | Merov Linden <merov@lindenlab.com> | 2010-11-24 12:56:40 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2010-11-24 12:56:40 -0800 |
commit | a9181819100910824b1fbb0a8799ec66ae35babd (patch) | |
tree | 1e14092e489ee5c84a6bf65d5df6bc1314e7a4ef /indra/llcommon/llthread.cpp | |
parent | 379c3858773e9079fbe9b0838b5f7625b5821718 (diff) | |
parent | 5c70975179d21fbd96dbf5de31c4c92c2b384f78 (diff) |
STORM-670 : merges fixes for CHOP-220 and CHOP-221
Diffstat (limited to 'indra/llcommon/llthread.cpp')
-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); + } } //============================================================================ |