diff options
| author | Xiaohong Bao <bao@lindenlab.com> | 2010-03-05 09:15:18 -0700 | 
|---|---|---|
| committer | Xiaohong Bao <bao@lindenlab.com> | 2010-03-05 09:15:18 -0700 | 
| commit | d33b6a18872a652808afe3aa9ae40de6adaa3004 (patch) | |
| tree | 6ea0bd6d39110f8cbf8a71c0806c5ca7dfa7f9fc /indra/llcommon | |
| parent | f7ad793e54a0dc4bec53e6ac56b15bb8115620a1 (diff) | |
| parent | b0d4919fd453fea9afc1cc0745140e83992997b6 (diff) | |
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llworkerthread.cpp | 36 | ||||
| -rw-r--r-- | indra/llcommon/llworkerthread.h | 3 | 
2 files changed, 38 insertions, 1 deletions
| diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 1b0e03cb2a..411977474b 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -65,6 +65,27 @@ LLWorkerThread::~LLWorkerThread()  	// ~LLQueuedThread() will be called here  } +//called only in destructor. +void LLWorkerThread::clearDeleteList() +{ +	// Delete any workers in the delete queue (should be safe - had better be!) +	if (!mDeleteList.empty()) +	{ +		llwarns << "Worker Thread: " << mName << " destroyed with " << mDeleteList.size() +				<< " entries in delete list." << llendl; + +		mDeleteMutex->lock(); +		for (delete_list_t::iterator iter = mDeleteList.begin(); iter != mDeleteList.end(); ++iter) +		{ +			(*iter)->mRequestHandle = LLWorkerThread::nullHandle(); +			(*iter)->clearFlags(LLWorkerClass::WCF_HAVE_WORK); +			delete *iter ; +		} +		mDeleteList.clear() ; +		mDeleteMutex->unlock() ; +	} +} +  // virtual  S32 LLWorkerThread::update(U32 max_time_ms)  { @@ -320,7 +341,20 @@ bool LLWorkerClass::checkWork(bool aborting)  	if (mRequestHandle != LLWorkerThread::nullHandle())  	{  		LLWorkerThread::WorkRequest* workreq = (LLWorkerThread::WorkRequest*)mWorkerThread->getRequest(mRequestHandle); -		llassert_always(workreq); +		if(!workreq) +		{ +			if(mWorkerThread->isQuitting() || mWorkerThread->isStopped()) //the mWorkerThread is not running +			{ +				mRequestHandle = LLWorkerThread::nullHandle(); +				clearFlags(WCF_HAVE_WORK); +				return true ; +			} +			else +			{ +				llassert_always(workreq); +			} +		} +  		LLQueuedThread::status_t status = workreq->getStatus();  		if (status == LLWorkerThread::STATUS_ABORTED)  		{ diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index a1e85d2ecc..1756ebab6b 100644 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -80,6 +80,9 @@ public:  		S32 mParam;  	}; +protected: +	void clearDeleteList() ; +  private:  	typedef std::list<LLWorkerClass*> delete_list_t;  	delete_list_t mDeleteList; | 
