diff options
author | Dave Parks <davep@lindenlab.com> | 2009-12-21 12:23:58 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2009-12-21 12:23:58 -0600 |
commit | 5562dc36a1555480ffbc4e45342206de003254af (patch) | |
tree | fa879bb5e4d4b4d66ac4ab5dfad3cafbd61013f0 | |
parent | 0ed1cd97d4cd1fa11ca21b1b324c80f446f6e675 (diff) |
Fix for OSX hating thread local state (hopefully).
-rw-r--r-- | indra/llcommon/llthread.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index df7ea214cc..0385569a02 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -62,7 +62,10 @@ // //---------------------------------------------------------------------------- +#if !LL_DARWIN U32 ll_thread_local sThreadID = 0; +#endif + U32 LLThread::sIDIter = 0; // @@ -75,7 +78,9 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap // Set thread state to running threadp->mStatus = RUNNING; +#if !LL_DARWIN sThreadID = threadp->mID; +#endif // Run the user supplied function threadp->run(); @@ -312,12 +317,16 @@ LLMutex::~LLMutex() void LLMutex::lock() { +#if LL_DARWIN + if (mLockingThread == LLThread::currentID()) +#else if (mLockingThread == sThreadID) +#endif { //redundant lock mCount++; return; } - + apr_thread_mutex_lock(mAPRMutexp); #if MUTEX_DEBUG @@ -328,7 +337,11 @@ void LLMutex::lock() mIsLocked[id] = TRUE; #endif +#if LL_DARWIN + mLockingThread = LLThread::currentID(); +#else mLockingThread = sThreadID; +#endif } void LLMutex::unlock() |