Merge remote-tracking branch 'aleric/V2MultiWear' into AltCompilers

This commit is contained in:
Drake Arconis
2012-07-02 21:25:40 +00:00
2 changed files with 7 additions and 1 deletions

View File

@@ -68,6 +68,7 @@ U32 ll_thread_local local_thread_ID = 0;
U32 LLThread::sIDIter = 0;
LLAtomicS32 LLThread::sCount = 0;
LLAtomicS32 LLThread::sRunning = 0;
LL_COMMON_API void assert_main_thread()
{
@@ -119,6 +120,7 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
// the critical area of the mSignal lock)].
lldebugs << "LLThread::staticRun() Exiting: " << name << llendl;
--sRunning; // Would be better to do this after joining with the thread, but we don't join :/
return NULL;
}
@@ -194,6 +196,7 @@ void LLThread::start()
// Set thread state to running
mStatus = RUNNING;
sRunning++;
apr_status_t status =
apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, tldata().mRootPool());
@@ -205,6 +208,7 @@ void LLThread::start()
}
else
{
--sRunning;
mStatus = STOPPED;
llwarns << "failed to start thread " << mName << llendl;
ll_apr_warn_status(status);

View File

@@ -78,6 +78,7 @@ class LL_COMMON_API LLThread
private:
static U32 sIDIter;
static LLAtomicS32 sCount;
static LLAtomicS32 sRunning;
public:
typedef enum e_thread_status
@@ -96,8 +97,9 @@ public:
static U32 currentID(); // Return ID of current thread
static S32 getCount() { return sCount; }
static S32 getRunning() { return sRunning; }
static void yield(); // Static because it can be called by the main thread, which doesn't have an LLThread data structure.
public:
// PAUSE / RESUME functionality. See source code for important usage notes.
// Called from MAIN THREAD.