summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2010-11-30 16:40:18 -0800
committerLeyla Farazha <leyla@lindenlab.com>2010-11-30 16:40:18 -0800
commit6e62c6c410df9001b56ffd57c6c6d8cd9fe035e6 (patch)
tree22a77be7720c4ea9cf9a17f70b00b14f68122454 /indra/llcommon
parentc489f33169bdf88df24c430c278038b2f5a0630a (diff)
parentb778ba9b882ecb03e61b3b9bd833618ca096f5da (diff)
Merge
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llthread.cpp24
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);
+ }
}
//============================================================================