Changeset 25478 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Dec 18, 2009 12:58:10 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56147
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
r25467 r25478 63 63 64 64 65 /** 66 * Copy a source position record. 67 * 68 * @param pDst The destination. 69 * @param pSrc The source. 70 */ 71 DECL_FORCE_INLINE(void) rtLockValidatorCopySrcPos(PRTLOCKVALIDATORSRCPOS pDst, PCRTLOCKVALIDATORSRCPOS pSrc) 72 { 73 ASMAtomicUoWriteU32(&pDst->uLine, pSrc->uLine); 74 ASMAtomicUoWritePtr((void * volatile *)&pDst->pszFile, pSrc->pszFile); 75 ASMAtomicUoWritePtr((void * volatile *)&pDst->pszFunction, pSrc->pszFunction); 76 ASMAtomicUoWritePtr((void * volatile *)&pDst->uId, (void *)pSrc->uId); 77 } 78 79 80 /** 81 * Init a source position record. 82 * 83 * @param pSrcPos The source position record. 84 */ 85 DECL_FORCE_INLINE(void) rtLockValidatorInitSrcPos(PRTLOCKVALIDATORSRCPOS pSrcPos) 86 { 87 pSrcPos->pszFile = NULL; 88 pSrcPos->pszFunction = NULL; 89 pSrcPos->uId = 0; 90 pSrcPos->uLine = 0; 91 #if HC_ARCH_BITS == 64 92 pSrcPos->u32Padding = 0; 93 #endif 94 } 95 65 96 66 97 /** … … 113 144 { 114 145 pRec->u32Magic = RTLOCKVALIDATORREC_MAGIC; 115 pRec->uLine = 0; 116 pRec->pszFile = NULL; 117 pRec->pszFunction = NULL; 118 pRec->uId = 0; 146 rtLockValidatorInitSrcPos(&pRec->SrcPos); 119 147 pRec->hThread = NIL_RTTHREAD; 120 148 pRec->pDown = NULL; … … 179 207 180 208 181 RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, RTHCUINTPTR uId, RT_SRC_POS_DECL)209 RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos) 182 210 { 183 211 AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); … … 205 233 206 234 207 RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALIDATORREC pRec, RTHCUINTPTR uId, RT_SRC_POS_DECL)235 RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALIDATORREC pRec, PCRTLOCKVALIDATORSRCPOS pSrcPos) 208 236 { 209 237 AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); … … 227 255 228 256 229 RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, RTHCUINTPTR uId, RT_SRC_POS_DECL)257 RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos) 230 258 { 231 259 AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, NIL_RTTHREAD); … … 248 276 * Update the record. 249 277 */ 250 ASMAtomicUoWriteU32(&pRec->uLine, iLine); 251 ASMAtomicUoWritePtr((void * volatile *)&pRec->pszFile, pszFile); 252 ASMAtomicUoWritePtr((void * volatile *)&pRec->pszFunction, pszFunction); 253 ASMAtomicUoWritePtr((void * volatile *)&pRec->uId, (void *)uId); 278 rtLockValidatorCopySrcPos(&pRec->SrcPos, pSrcPos); 254 279 ASMAtomicUoWriteU32(&pRec->cRecursion, 1); 255 256 280 ASMAtomicWriteHandle(&pRec->hThread, hThread); 257 281 … … 369 393 * @param pCur The thread we're deadlocking with. 370 394 * @param enmState The sleep state. 371 * @param RT_SRC_POS_DECL Where we are going to deadlock. 372 * @param uId Where we are going to deadlock. 395 * @param pSrcPos Where we are going to deadlock. 373 396 */ 374 397 static void rtLockValidatorComplainAboutDeadlock(PRTLOCKVALIDATORREC pRec, PRTTHREADINT pThread, RTTHREADSTATE enmState, 375 PRTTHREADINT pCur, RTHCUINTPTR uId, RT_SRC_POS_DECL)376 { 377 AssertMsg1(pCur == pThread ? "!!Deadlock detected!!" : "!!Deadlock exists!!", iLine, pszFile,pszFunction);398 PRTTHREADINT pCur, PCRTLOCKVALIDATORSRCPOS pSrcPos) 399 { 400 AssertMsg1(pCur == pThread ? "!!Deadlock detected!!" : "!!Deadlock exists!!", pSrcPos->uLine, pSrcPos->pszFile, pSrcPos->pszFunction); 378 401 379 402 /* … … 390 413 AssertMsg2(" #%u: %RTthrd/%RTnthrd %s: %s(%u) %RTptr\n", 391 414 iEntry, pCur, pCur->Core.Key, pCur->szName, 392 pCur->LockValidator. pszBlockFile, pCur->LockValidator.uBlockLine,393 pCur->LockValidator. pszBlockFunction, pCur->LockValidator.uBlockId);415 pCur->LockValidator.SrcPos.pszFile, pCur->LockValidator.SrcPos.uLine, 416 pCur->LockValidator.SrcPos.pszFunction, pCur->LockValidator.SrcPos.uId); 394 417 PRTTHREADINT pNext = NULL; 395 418 RTTHREADSTATE enmCurState = rtThreadGetState(pCur); … … 418 441 AssertMsg2(" Waiting on %s %p [%s]: Entered %s(%u) %s %p\n", 419 442 RTThreadStateName(enmCurState), pCurRec->hLock, pCurRec->pszName, 420 pCurRec-> pszFile, pCurRec->uLine, pCurRec->pszFunction, pCurRec->uId);443 pCurRec->SrcPos.pszFile, pCurRec->SrcPos.uLine, pCurRec->SrcPos.pszFunction, pCurRec->SrcPos.uId); 421 444 pNext = pCurRec->hThread; 422 445 } … … 461 484 RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, 462 485 RTTHREADSTATE enmState, bool fRecursiveOk, 463 RTHCUINTPTR uId, RT_SRC_POS_DECL)486 PCRTLOCKVALIDATORSRCPOS pSrcPos) 464 487 { 465 488 /* … … 482 505 * performing deadlock detection. 483 506 */ 484 /** @todo This has to be serialized! The deadlock detection isn't 100% safe!!! */ 485 pThread->LockValidator.pRec = pRec; 486 pThread->LockValidator.pszBlockFunction = pszFunction; 487 pThread->LockValidator.pszBlockFile = pszFile; 488 pThread->LockValidator.uBlockLine = iLine; 489 pThread->LockValidator.uBlockId = uId; 490 491 RTThreadBlocking(hThread, enmState); 507 pThread->LockValidator.pRec = pRec; 508 rtLockValidatorCopySrcPos(&pThread->LockValidator.SrcPos, pSrcPos); 492 509 493 510 /* … … 604 621 * Ok, if we ever get here, it's most likely a genuine deadlock. 605 622 */ 606 rtLockValidatorComplainAboutDeadlock(pRec, pThread, enmState, pCur, uId, RT_SRC_POS_ARGS);623 rtLockValidatorComplainAboutDeadlock(pRec, pThread, enmState, pCur, pSrcPos); 607 624 608 625 rtLockValidatorSerializeDetectionLeave(); -
trunk/src/VBox/Runtime/generic/critsect-generic.cpp
r25467 r25478 244 244 ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf); 245 245 #ifdef RTCRITSECT_STRICT 246 RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS); 246 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 247 RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, &SrcPos); 247 248 #endif 248 249 … … 283 284 RTNATIVETHREAD NativeThreadSelf = RTThreadNativeSelf(); 284 285 #ifdef RTCRITSECT_STRICT 285 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 286 RTLockValidatorCheckOrder(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS); 286 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 287 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 288 RTLockValidatorCheckOrder(pCritSect->pValidatorRec, hThreadSelf, &SrcPos); 287 289 #endif 288 290 … … 324 326 int rc9 = RTLockValidatorCheckBlocking(pCritSect->pValidatorRec, hThreadSelf, RTTHREADSTATE_CRITSECT, 325 327 !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING), 326 uId, RT_SRC_POS_ARGS);328 &SrcPos); 327 329 if (RT_FAILURE(rc9)) 328 330 { … … 330 332 return rc9; 331 333 } 332 #e lse334 #endif 333 335 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_CRITSECT); 334 #endif335 336 336 337 int rc = RTSemEventWait(pCritSect->EventSem, RT_INDEFINITE_WAIT); … … 352 353 ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf); 353 354 #ifdef RTCRITSECT_STRICT 354 RTLockValidatorSetOwner(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS);355 RTLockValidatorSetOwner(pCritSect->pValidatorRec, hThreadSelf, &SrcPos); 355 356 #endif 356 357 -
trunk/src/VBox/Runtime/include/internal/lockvalidator.h
r25436 r25478 48 48 /** What we're blocking on. */ 49 49 PRTLOCKVALIDATORREC pRec; 50 /** Where we're blocking. */ 51 const char volatile *pszBlockFunction; 52 /** Where we're blocking. */ 53 const char volatile *pszBlockFile; 54 /** Where we're blocking. */ 55 uint32_t volatile uBlockLine; 56 /** Where we're blocking. */ 57 RTHCUINTPTR volatile uBlockId; 58 50 /** Where we are blocking. */ 51 RTLOCKVALIDATORSRCPOS SrcPos; 59 52 /** Number of registered write locks, mutexes and critsects that this thread owns. */ 60 53 int32_t volatile cWriteLocks; -
trunk/src/VBox/Runtime/include/internal/strict.h
r25467 r25478 58 58 #endif 59 59 60 #ifdef RTSEMMUTEX_STRICT61 # define RTSEMMUTEX_STRICT_POS_DECL RTHCUINTPTR uId, RT_SRC_POS_DECL62 # define RTSEMMUTEX_STRICT_POS_ARGS uId, RT_SRC_POS_ARGS63 #else64 # define RTSEMMUTEX_STRICT_POS_DECL int iDummy65 # define RTSEMMUTEX_STRICT_POS_ARGS 066 #endif67 68 60 69 61 /** @def RTSEMRW_STRICT … … 74 66 #endif 75 67 76 #ifdef RTSEMRW_STRICT77 # define RTSEMRW_STRICT_POS_DECL RTHCUINTPTR uId, RT_SRC_POS_DECL78 # define RTSEMRW_STRICT_POS_ARGS uId, RT_SRC_POS_ARGS79 #else80 # define RTSEMRW_STRICT_POS_DECL int iDummy81 # define RTSEMRW_STRICT_POS_ARGS 082 #endif83 84 68 85 69 -
trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp
r25467 r25478 167 167 168 168 169 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, bool fAutoResume, RTSEMMUTEX_STRICT_POS_DECL)169 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, bool fAutoResume, PCRTLOCKVALIDATORSRCPOS pSrcPos) 170 170 { 171 171 /* … … 178 178 #ifdef RTSEMMUTEX_STRICT 179 179 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 180 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);180 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 181 181 #endif 182 182 … … 232 232 #ifdef RTSEMMUTEX_STRICT 233 233 int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf, 234 RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS);234 RTTHREADSTATE_MUTEX, true, pSrcPos); 235 235 if (RT_FAILURE(rc9)) 236 236 return rc9; 237 #e lse237 #endif 238 238 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX); 239 #endif240 239 } 241 240 … … 300 299 ASMAtomicWriteU32(&pThis->cNesting, 1); 301 300 #ifdef RTSEMMUTEX_STRICT 302 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);301 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 303 302 #endif 304 303 return VINF_SUCCESS; … … 309 308 { 310 309 #ifndef RTSEMMUTEX_STRICT 311 int rc = rtSemMutexRequest(MutexSem, cMillies, true, RTSEMMUTEX_STRICT_POS_ARGS); 310 int rc = rtSemMutexRequest(MutexSem, cMillies, true, NULL); 311 #else 312 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API(); 313 int rc = rtSemMutexRequest(MutexSem, cMillies, true, &SrcPos); 314 #endif 312 315 Assert(rc != VERR_INTERRUPTED); 313 316 return rc; 314 #else315 return RTSemMutexRequestDebug(MutexSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS);316 #endif317 317 } 318 318 … … 320 320 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 321 321 { 322 #ifdef RTSEMMUTEX_STRICT 323 int rc = rtSemMutexRequest(MutexSem, cMillies, true, RTSEMMUTEX_STRICT_POS_ARGS);322 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 323 int rc = rtSemMutexRequest(MutexSem, cMillies, true, &SrcPos); 324 324 Assert(rc != VERR_INTERRUPTED); 325 325 return rc; 326 } 327 328 329 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies) 330 { 331 #ifndef RTSEMMUTEX_STRICT 332 return rtSemMutexRequest(MutexSem, cMillies, false, NULL); 326 333 #else 327 return RTSemMutexRequest(MutexSem, cMillies); 328 #endif 329 } 330 331 332 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies) 333 { 334 #ifndef RTSEMMUTEX_STRICT 335 return rtSemMutexRequest(MutexSem, cMillies, false, RTSEMMUTEX_STRICT_POS_ARGS); 336 #else 337 return RTSemMutexRequestNoResumeDebug(MutexSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS); 334 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API(); 335 return rtSemMutexRequest(MutexSem, cMillies, false, &SrcPos); 338 336 #endif 339 337 } … … 342 340 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 343 341 { 344 #ifdef RTSEMMUTEX_STRICT 345 return rtSemMutexRequest(MutexSem, cMillies, false, RTSEMMUTEX_STRICT_POS_ARGS); 346 #else 347 return RTSemMutexRequest(MutexSem, cMillies); 348 #endif 342 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 343 return rtSemMutexRequest(MutexSem, cMillies, false, &SrcPos); 349 344 } 350 345 -
trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
r25467 r25478 155 155 156 156 157 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, RTSEMMUTEX_STRICT_POS_DECL)157 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, PCRTLOCKVALIDATORSRCPOS pSrcPos) 158 158 { 159 159 /* … … 166 166 #ifdef RTSEMMUTEX_STRICT 167 167 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 168 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);168 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 169 169 #endif 170 170 … … 190 190 #ifdef RTSEMMUTEX_STRICT 191 191 int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf, 192 RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS);192 RTTHREADSTATE_MUTEX, true, pSrcPos); 193 193 if (RT_FAILURE(rc9)) 194 194 return rc9; 195 #e lse195 #endif 196 196 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX); 197 #endif198 197 } 199 198 … … 248 247 ASMAtomicWriteU32(&pThis->cNesting, 1); 249 248 #ifdef RTSEMMUTEX_STRICT 250 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);249 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 251 250 #endif 252 251 … … 258 257 { 259 258 #ifndef RTSEMMUTEX_STRICT 260 return rtSemMutexRequest(MutexSem, cMillies, RTSEMMUTEX_STRICT_POS_ARGS);259 return rtSemMutexRequest(MutexSem, cMillies, NULL); 261 260 #else 262 return RTSemMutexRequestDebug(MutexSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS); 261 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API(); 262 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 263 263 #endif 264 264 } … … 267 267 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 268 268 { 269 #ifdef RTSEMMUTEX_STRICT 270 return rtSemMutexRequest(MutexSem, cMillies, RTSEMMUTEX_STRICT_POS_ARGS); 269 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 270 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 271 } 272 273 274 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies) 275 { 276 /* (EINTR isn't returned by the wait functions we're using.) */ 277 #ifndef RTSEMMUTEX_STRICT 278 return rtSemMutexRequest(MutexSem, cMillies, NULL); 271 279 #else 272 return RTSemMutexRequest(MutexSem, cMillies); 273 #endif 274 } 275 276 277 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies) 278 { 279 /* EINTR isn't returned by the wait functions we're using. */ 280 #ifndef RTSEMMUTEX_STRICT 281 return RTSemMutexRequest(MutexSem, cMillies); 282 #else 283 return RTSemMutexRequestDebug(MutexSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS); 280 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API(); 281 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 284 282 #endif 285 283 } … … 288 286 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 289 287 { 290 /* EINTR isn't returned by the wait functions we're using. */ 291 #ifdef RTSEMMUTEX_STRICT 292 return RTSemMutexRequestDebug(MutexSem, cMillies, RTSEMMUTEX_STRICT_POS_ARGS); 293 #else 294 return RTSemMutexRequest(MutexSem, cMillies); 295 #endif 288 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 289 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 296 290 } 297 291 -
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25467 r25478 315 315 316 316 317 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, RTSEMRW_STRICT_POS_DECL)317 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, PCRTLOCKVALIDATORSRCPOS pSrcPos) 318 318 { 319 319 /* … … 327 327 #ifdef RTSEMRW_STRICT 328 328 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 329 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, RTSEMRW_STRICT_POS_ARGS);329 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 330 330 #endif 331 331 … … 339 339 { 340 340 #ifdef RTSEMRW_STRICT 341 int rc9 = RTLockValidatorRecordRecursion(&pThis->ValidatorRec, RTSEMRW_STRICT_POS_ARGS);341 int rc9 = RTLockValidatorRecordRecursion(&pThis->ValidatorRec, pSrcPos); 342 342 if (RT_FAILURE(rc9)) 343 343 return rc9; … … 357 357 { 358 358 #ifdef RTSEMRW_STRICT 359 int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf, RTTHREADSTATE_RW_WRITE, true, uId, RT_SRC_POS_ARGS);359 int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf, RTTHREADSTATE_RW_WRITE, true, pSrcPos); 360 360 if (RT_FAILURE(rc9)) 361 361 return rc9; 362 #e lse362 #endif 363 363 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE); 364 #endif365 364 } 366 365 … … 412 411 pThis->cWrites = 1; 413 412 #ifdef RTSEMRW_STRICT 414 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMRW_STRICT_POS_ARGS);413 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 415 414 #endif 416 415 return VINF_SUCCESS; … … 421 420 { 422 421 #ifndef RTSEMRW_STRICT 423 return rtSemRWRequestWrite(RWSem, cMillies, RTSEMRW_STRICT_POS_ARGS);422 return rtSemRWRequestWrite(RWSem, cMillies, NULL); 424 423 #else 425 return RTSemRWRequestWriteDebug(RWSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS); 424 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API(); 425 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 426 426 #endif 427 427 } … … 430 430 RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 431 431 { 432 #ifdef RTSEMRW_STRICT 433 return rtSemRWRequestWrite(RWSem, cMillies, RTSEMRW_STRICT_POS_ARGS); 434 #else 435 return RTSemRWRequestWrite(RWSem, cMillies); 436 #endif 432 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 433 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 437 434 } 438 435 … … 442 439 /* EINTR isn't returned by the wait functions we're using. */ 443 440 #ifndef RTSEMRW_STRICT 444 return RTSemRWRequestWrite(RWSem, cMillies);441 return rtSemRWRequestWrite(RWSem, cMillies, NULL); 445 442 #else 446 return RTSemRWRequestWriteDebug(RWSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS); 443 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API(); 444 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 447 445 #endif 448 446 } … … 452 450 { 453 451 /* EINTR isn't returned by the wait functions we're using. */ 454 #ifdef RTSEMRW_STRICT 455 return RTSemRWRequestWriteDebug(RWSem, cMillies, RTSEMRW_STRICT_POS_ARGS); 456 #else 457 return RTSemRWRequestWrite(RWSem, cMillies); 458 #endif 452 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 453 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 459 454 } 460 455 -
trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp
r25467 r25478 138 138 * 139 139 * @returns Same as RTSEmMutexRequestNoResume 140 * @param MutexSem 141 * @param cMillies 142 * @param TSEMMUTEX_STRICT_POS_DECLThe source position of the caller.140 * @param MutexSem The mutex handle. 141 * @param cMillies The number of milliseconds to wait. 142 * @param pSrcPos The source position of the caller. 143 143 */ 144 DECL_FORCE_INLINE(int) rtSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies, RTSEMMUTEX_STRICT_POS_DECL)144 DECL_FORCE_INLINE(int) rtSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies, PCRTLOCKVALIDATORSRCPOS pSrcPos) 145 145 { 146 146 /* … … 153 153 #ifdef RTSEMMUTEX_STRICT 154 154 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 155 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);155 RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 156 156 #else 157 157 RTTHREAD hThreadSelf = RTThreadSelf(); … … 165 165 #ifdef RTSEMMUTEX_STRICT 166 166 int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf, 167 RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS);167 RTTHREADSTATE_MUTEX, true, pSrcPos); 168 168 if (RT_FAILURE(rc9)) 169 169 return rc9; 170 #e lse170 #endif 171 171 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX); 172 #endif173 172 } 174 173 int rc = WaitForSingleObjectEx(pThis->hMtx, … … 180 179 case WAIT_OBJECT_0: 181 180 #ifdef RTSEMMUTEX_STRICT 182 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);181 RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos); 183 182 #endif 184 183 return VINF_SUCCESS; … … 204 203 { 205 204 #ifndef RTSEMMUTEX_STRICT 206 return rtSemMutexRequestNoResume(MutexSem, cMillies, RTSEMMUTEX_STRICT_POS_ARGS);205 return rtSemMutexRequestNoResume(MutexSem, cMillies, NULL); 207 206 #else 208 return RTSemMutexRequestNoResumeDebug(MutexSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS); 207 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API(); 208 return rtSemMutexRequestNoResume(MutexSem, cMillies, &SrcPos); 209 209 #endif 210 210 } … … 213 213 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 214 214 { 215 #ifdef RTSEMMUTEX_STRICT 216 return rtSemMutexRequestNoResume(MutexSem, cMillies, RTSEMMUTEX_STRICT_POS_ARGS); 217 #else 218 return RTSemMutexRequestNoResume(MutexSem, cMillies); 219 #endif 215 RTLOCKVALIDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API(); 216 return rtSemMutexRequestNoResume(MutexSem, cMillies, &SrcPos); 220 217 } 221 218
Note:
See TracChangeset
for help on using the changeset viewer.