Changeset 25715 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Jan 11, 2010 12:44:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp
r25711 r25715 74 74 int32_t volatile iState; 75 75 /** Nesting count. */ 76 uint32_t volatile cNesting ;76 uint32_t volatile cNestings; 77 77 /** The owner of the mutex. */ 78 78 pthread_t volatile Owner; … … 86 86 87 87 88 /* Undefine debug mappings. */89 #undef RTSemMutexRequest90 #undef RTSemMutexRequestNoResume91 92 88 93 89 /** … … 125 121 if (pThis) 126 122 { 127 pThis->u32Magic = RTSEMMUTEX_MAGIC;128 pThis->iState = 0;129 pThis->Owner = (pthread_t)~0;130 pThis->cNesting = 0;123 pThis->u32Magic = RTSEMMUTEX_MAGIC; 124 pThis->iState = 0; 125 pThis->Owner = (pthread_t)~0; 126 pThis->cNestings = 0; 131 127 #ifdef RTSEMMUTEX_STRICT 132 128 va_list va; … … 167 163 usleep(1000); 168 164 } 169 pThis->Owner = (pthread_t)~0;170 pThis->cNesting = 0;165 pThis->Owner = (pthread_t)~0; 166 pThis->cNestings = 0; 171 167 #ifdef RTSEMMUTEX_STRICT 172 168 RTLockValidatorRecExclDelete(&pThis->ValidatorRec); … … 212 208 pthread_t Self = pthread_self(); 213 209 if ( pThis->Owner == Self 214 && pThis->cNesting > 0)210 && pThis->cNestings > 0) 215 211 { 216 212 #ifdef RTSEMMUTEX_STRICT … … 219 215 return rc9; 220 216 #endif 221 ASMAtomicIncU32(&pThis->cNesting );217 ASMAtomicIncU32(&pThis->cNestings); 222 218 return VINF_SUCCESS; 223 219 } … … 338 334 */ 339 335 pThis->Owner = Self; 340 ASMAtomicWriteU32(&pThis->cNesting , 1);336 ASMAtomicWriteU32(&pThis->cNestings, 1); 341 337 #ifdef RTSEMMUTEX_STRICT 342 338 RTLockValidatorRecExclSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true); … … 346 342 347 343 344 #undef RTSemMutexRequest 348 345 RTDECL(int) RTSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies) 349 346 { … … 368 365 369 366 367 #undef RTSemMutexRequestNoResume 370 368 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies) 371 369 { … … 396 394 397 395 #ifdef RTSEMMUTEX_STRICT 398 int rc9 = RTLockValidatorRecExclReleaseOwner(&pThis->ValidatorRec, pThis->cNestings != 1);396 int rc9 = RTLockValidatorRecExclReleaseOwner(&pThis->ValidatorRec, pThis->cNestings == 1); 399 397 if (RT_FAILURE(rc9)) 400 398 return rc9; … … 406 404 pthread_t Self = pthread_self(); 407 405 if (RT_UNLIKELY( pThis->Owner != Self 408 || pThis->cNesting == 0))409 { 410 AssertMsgFailed(("Not owner of mutex %p!! Self=%08x Owner=%08x cNesting =%d\n",411 pThis, Self, pThis->Owner, pThis->cNesting ));406 || pThis->cNestings == 0)) 407 { 408 AssertMsgFailed(("Not owner of mutex %p!! Self=%08x Owner=%08x cNestings=%d\n", 409 pThis, Self, pThis->Owner, pThis->cNestings)); 412 410 return VERR_NOT_OWNER; 413 411 } … … 416 414 * If nested we'll just pop a nesting. 417 415 */ 418 if (pThis->cNesting > 1)419 { 420 ASMAtomicDecU32(&pThis->cNesting );416 if (pThis->cNestings > 1) 417 { 418 ASMAtomicDecU32(&pThis->cNestings); 421 419 return VINF_SUCCESS; 422 420 } 423 421 424 422 /* 425 * Clear the state. (cNesting == 1)423 * Clear the state. (cNestings == 1) 426 424 */ 427 425 pThis->Owner = (pthread_t)~0; 428 ASMAtomicWriteU32(&pThis->cNesting , 0);426 ASMAtomicWriteU32(&pThis->cNestings, 0); 429 427 430 428 /*
Note:
See TracChangeset
for help on using the changeset viewer.