diff options
author | Armin Weatherwax | 2010-03-02 14:55:47 +0100 |
---|---|---|
committer | Armin Weatherwax | 2010-03-04 22:38:49 +0100 |
commit | 5cad29e95879a5a08cb1a8dabfff8eda17e55763 (patch) | |
tree | 3122db3e78f243ce7a5053a7d6c7ea5446537059 /linden/indra/llcommon | |
parent | Robin Cornelius, Aleric Inglewood: SNOW-196 missing mutexes for texture fetch (diff) | |
download | meta-impy-5cad29e95879a5a08cb1a8dabfff8eda17e55763.zip meta-impy-5cad29e95879a5a08cb1a8dabfff8eda17e55763.tar.gz meta-impy-5cad29e95879a5a08cb1a8dabfff8eda17e55763.tar.bz2 meta-impy-5cad29e95879a5a08cb1a8dabfff8eda17e55763.tar.xz |
Aleric Inglewood: SNOW-196 Special case for TextureFetch race condition check.
Where the current UUID was just removed from mRequestMap, thus avoiding to the
need for the problematic lock completely. The case that we add something to
mNetworkQueue while it was just removed from mRequestMap is corrected by
LLTextureFetch::sendRequestListToSimulators anyway.
Diffstat (limited to 'linden/indra/llcommon')
-rw-r--r-- | linden/indra/llcommon/llthread.cpp | 35 | ||||
-rw-r--r-- | linden/indra/llcommon/llthread.h | 8 |
2 files changed, 8 insertions, 35 deletions
diff --git a/linden/indra/llcommon/llthread.cpp b/linden/indra/llcommon/llthread.cpp index 60ccd5c..692d6c4 100644 --- a/linden/indra/llcommon/llthread.cpp +++ b/linden/indra/llcommon/llthread.cpp | |||
@@ -283,7 +283,6 @@ LLMutex::LLMutex(apr_pool_t *poolp) : | |||
283 | apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mAPRPoolp); | 283 | apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mAPRPoolp); |
284 | } | 284 | } |
285 | 285 | ||
286 | |||
287 | LLMutex::~LLMutex() | 286 | LLMutex::~LLMutex() |
288 | { | 287 | { |
289 | #if _DEBUG | 288 | #if _DEBUG |
@@ -297,40 +296,14 @@ LLMutex::~LLMutex() | |||
297 | } | 296 | } |
298 | } | 297 | } |
299 | 298 | ||
300 | |||
301 | void LLMutex::lock() | ||
302 | { | ||
303 | apr_thread_mutex_lock(mAPRMutexp); | ||
304 | } | ||
305 | |||
306 | void LLMutex::unlock() | ||
307 | { | ||
308 | apr_thread_mutex_unlock(mAPRMutexp); | ||
309 | } | ||
310 | |||
311 | bool LLMutex::isLocked() | 299 | bool LLMutex::isLocked() |
312 | { | 300 | { |
313 | apr_status_t status = apr_thread_mutex_trylock(mAPRMutexp); | 301 | if (!tryLock()) |
314 | if (APR_STATUS_IS_EBUSY(status)) | ||
315 | { | 302 | { |
316 | return true; | 303 | return true; |
317 | } | 304 | } |
318 | else | 305 | apr_thread_mutex_unlock(mAPRMutexp); |
319 | { | 306 | return false; |
320 | apr_thread_mutex_unlock(mAPRMutexp); | ||
321 | return false; | ||
322 | } | ||
323 | } | ||
324 | |||
325 | //trys to grab a lock and if sucessful returns true | ||
326 | bool LLMutex::tryLock() | ||
327 | { | ||
328 | apr_status_t status = apr_thread_mutex_trylock(mAPRMutexp); | ||
329 | if (APR_STATUS_IS_EBUSY(status)) | ||
330 | { | ||
331 | return false; | ||
332 | } | ||
333 | return true; | ||
334 | } | 307 | } |
335 | 308 | ||
336 | //============================================================================ | 309 | //============================================================================ |
@@ -343,14 +316,12 @@ LLCondition::LLCondition(apr_pool_t *poolp) : | |||
343 | apr_thread_cond_create(&mAPRCondp, mAPRPoolp); | 316 | apr_thread_cond_create(&mAPRCondp, mAPRPoolp); |
344 | } | 317 | } |
345 | 318 | ||
346 | |||
347 | LLCondition::~LLCondition() | 319 | LLCondition::~LLCondition() |
348 | { | 320 | { |
349 | apr_thread_cond_destroy(mAPRCondp); | 321 | apr_thread_cond_destroy(mAPRCondp); |
350 | mAPRCondp = NULL; | 322 | mAPRCondp = NULL; |
351 | } | 323 | } |
352 | 324 | ||
353 | |||
354 | void LLCondition::wait() | 325 | void LLCondition::wait() |
355 | { | 326 | { |
356 | apr_thread_cond_wait(mAPRCondp, mAPRMutexp); | 327 | apr_thread_cond_wait(mAPRCondp, mAPRMutexp); |
diff --git a/linden/indra/llcommon/llthread.h b/linden/indra/llcommon/llthread.h index d773fa4..ed76a3b 100644 --- a/linden/indra/llcommon/llthread.h +++ b/linden/indra/llcommon/llthread.h | |||
@@ -131,10 +131,12 @@ public: | |||
131 | LLMutex(apr_pool_t *apr_poolp); // NULL pool constructs a new pool for the mutex | 131 | LLMutex(apr_pool_t *apr_poolp); // NULL pool constructs a new pool for the mutex |
132 | ~LLMutex(); | 132 | ~LLMutex(); |
133 | 133 | ||
134 | void lock(); // blocks | 134 | void lock() { apr_thread_mutex_lock(mAPRMutexp); } |
135 | void unlock(); | 135 | void unlock() { apr_thread_mutex_unlock(mAPRMutexp); } |
136 | // Returns true if lock was obtained successfully. | ||
137 | bool tryLock() { return !APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mAPRMutexp)); } | ||
138 | |||
136 | bool isLocked(); // non-blocking, but does do a lock/unlock so not free | 139 | bool isLocked(); // non-blocking, but does do a lock/unlock so not free |
137 | bool tryLock(); //non-blocking, but not free, returns true if grabed lock | ||
138 | 140 | ||
139 | protected: | 141 | protected: |
140 | apr_thread_mutex_t *mAPRMutexp; | 142 | apr_thread_mutex_t *mAPRMutexp; |