Changeset 25614 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Jan 1, 2010 2:19:06 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56305
- Location:
- trunk/src/VBox/Runtime/r3/posix
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
r25607 r25614 164 164 AssertReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, VERR_INVALID_HANDLE); 165 165 166 #ifdef RTSEMMUTEX_STRICT167 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt();168 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos);169 #endif170 171 166 /* 172 167 * Check if nested request. … … 176 171 && pThis->cNesting > 0) 177 172 { 173 #ifdef RTSEMMUTEX_STRICT 174 int rc9 = RTLockValidatorRecExclRecursion(&pThis->ValidatorRec, pSrcPos); 175 if (RT_FAILURE(rc9)) 176 return rc9; 177 #endif 178 178 ASMAtomicIncU32(&pThis->cNesting); 179 179 return VINF_SUCCESS; 180 180 } 181 #ifndef RTSEMMUTEX_STRICT182 RTTHREAD hThreadSelf = RTThreadSelf();183 #endif184 181 185 182 /* 186 183 * Lock it. 187 184 */ 185 RTTHREAD hThreadSelf = NIL_RTTHREAD; 188 186 if (cMillies != 0) 189 187 { 190 188 #ifdef RTSEMMUTEX_STRICT 191 int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf,192 RTTHREADSTATE_MUTEX, true, pSrcPos);189 hThreadSelf = RTThreadSelfAutoAdopt(); 190 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true); 193 191 if (RT_FAILURE(rc9)) 194 192 return rc9; 193 #else 194 hThreadSelf = RTThreadSelf(); 195 195 #endif 196 196 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX); … … 247 247 ASMAtomicWriteU32(&pThis->cNesting, 1); 248 248 #ifdef RTSEMMUTEX_STRICT 249 RTLockValidator SetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos);249 RTLockValidatorRecExclSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true); 250 250 #endif 251 251 … … 300 300 AssertReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, VERR_INVALID_HANDLE); 301 301 302 #ifdef RTSEMMUTEX_STRICT 303 int rc9 = RTLockValidatorRecExclReleaseOwner(&pThis->ValidatorRec, pThis->cNesting == 1); 304 if (RT_FAILURE(rc9)) 305 return rc9; 306 #endif 307 302 308 /* 303 309 * Check if nested. … … 324 330 * Clear the state. (cNesting == 1) 325 331 */ 326 #ifdef RTSEMMUTEX_STRICT327 RTLockValidatorUnsetOwner(&pThis->ValidatorRec);328 #endif329 332 pThis->Owner = (pthread_t)-1; 330 333 ASMAtomicXchgU32(&pThis->cNesting, 0); -
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25607 r25614 202 202 { 203 203 #ifdef RTSEMRW_STRICT 204 int rc9 = RTLockValidatorRec ordReadWriteRecursion(&pThis->ValidatorWrite, &pThis->ValidatorRead, pSrcPos);204 int rc9 = RTLockValidatorRecExclRecursionMixed(&pThis->ValidatorWrite, &pThis->ValidatorRead->Core, pSrcPos); 205 205 if (RT_FAILURE(rc9)) 206 206 return rc9; … … 214 214 * Try lock it. 215 215 */ 216 #ifdef RTSEMRW_STRICT 217 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 218 #else 219 RTTHREAD hThreadSelf = RTThreadSelf(); 220 #endif 216 RTTHREAD hThreadSelf = NIL_RTTHREAD; 221 217 if (cMillies > 0) 222 218 { 223 219 #ifdef RTSEMRW_STRICT 224 int rc9 = RTLockValidatorCheckReadOrderBlocking(&pThis->ValidatorRead, &pThis->ValidatorWrite,225 hThreadSelf, RTTHREADSTATE_RW_READ, false, pSrcPos);220 hThreadSelf = RTThreadSelfAutoAdopt(); 221 int rc9 = RTLockValidatorRecSharedCheckOrderAndBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true); 226 222 if (RT_FAILURE(rc9)) 227 223 return rc9; 224 #else 225 hThreadSelf = RTThreadSelf(); 228 226 #endif 229 227 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_READ); … … 277 275 ASMAtomicIncU32(&pThis->cReaders); 278 276 #ifdef RTSEMRW_STRICT 279 RTLockValidator AddReadOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos);277 RTLockValidatorSharedRecAddOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos); 280 278 #endif 281 279 return VINF_SUCCESS; … … 311 309 AssertMsgReturn(pThis->cWriterReads > 0, ("pThis=%p\n", pThis), VERR_NOT_OWNER); 312 310 #ifdef RTSEMRW_STRICT 313 int rc9 = RTLockValidator UnwindReadWriteRecursion(&pThis->ValidatorWrite, &pThis->ValidatorRead);311 int rc9 = RTLockValidatorRecExclUnwindMixed(&pThis->ValidatorWrite, &pThis->ValidatorRead->Core.); 314 312 if (RT_FAILURE(rc9)) 315 313 return rc9; … … 323 321 */ 324 322 #ifdef RTSEMRW_STRICT 325 int rc9 = RTLockValidator CheckAndReleaseReadOwner(&pThis->ValidatorRead, RTThreadSelf());323 int rc9 = RTLockValidatorRecSharedCheckAndRelease(&pThis->ValidatorRead, RTThreadSelf()); 326 324 if (RT_FAILURE(rc9)) 327 325 return rc9; … … 356 354 ("pThis=%p u32Magic=%#x\n", pThis, pThis->u32Magic), 357 355 VERR_INVALID_HANDLE); 356 358 357 /* 359 358 * Recursion? … … 365 364 { 366 365 #ifdef RTSEMRW_STRICT 367 int rc9 = RTLockValidatorRec ordRecursion(&pThis->ValidatorWrite, pSrcPos);366 int rc9 = RTLockValidatorRecExclRecursion(&pThis->ValidatorWrite, pSrcPos); 368 367 if (RT_FAILURE(rc9)) 369 368 return rc9; … … 377 376 * Try lock it. 378 377 */ 379 #ifdef RTSEMRW_STRICT 380 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 381 #else 382 RTTHREAD hThreadSelf = RTThreadSelf(); 383 #endif 378 RTTHREAD hThreadSelf = NIL_RTTHREAD; 384 379 if (cMillies) 385 380 { 386 381 #ifdef RTSEMRW_STRICT 387 int rc9 = RTLockValidatorCheckWriteOrderBlocking(&pThis->ValidatorWrite, &pThis->ValidatorRead,388 hThreadSelf, RTTHREADSTATE_RW_WRITE, true, pSrcPos);382 hThreadSelf = RTThreadSelfAutoAdopt(); 383 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true); 389 384 if (RT_FAILURE(rc9)) 390 385 return rc9; 386 #else 387 hThreadSelf = RTThreadSelf(); 391 388 #endif 392 389 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE); … … 436 433 #endif /* !RT_OS_DARWIN */ 437 434 } 435 } 438 436 439 437 ATOMIC_SET_PTHREAD_T(&pThis->Writer, Self); … … 441 439 Assert(!pThis->cReaders); 442 440 #ifdef RTSEMRW_STRICT 443 RTLockValidator SetOwner(&pThis->ValidatorWrite, hThreadSelf, pSrcPos);441 RTLockValidatorRecExclSetOwner(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true); 444 442 #endif 445 443 return VINF_SUCCESS; … … 508 506 { 509 507 #ifdef RTSEMRW_STRICT 510 int rc9 = RTLockValidator UnwindRecursion(&pThis->ValidatorWrite);508 int rc9 = RTLockValidatorRecExclUnwind(&pThis->ValidatorWrite); 511 509 if (RT_FAILURE(rc9)) 512 510 return rc9; … … 521 519 */ 522 520 #ifdef RTSEMRW_STRICT 523 int rc9 = RTLockValidator CheckAndRelease(&pThis->ValidatorWrite);521 int rc9 = RTLockValidatorRecExclReleaseOwner(&pThis->ValidatorWrite); 524 522 if (RT_FAILURE(rc9)) 525 523 return rc9;
Note:
See TracChangeset
for help on using the changeset viewer.