Changeset 28267 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Apr 13, 2010 5:11:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
r27292 r28267 4281 4281 4282 4282 4283 RTDECL(bool) RTLockValidatorHoldsLocksInClass(RTTHREAD hCurrentThread, RTLOCKVALCLASS hClass) 4284 { 4285 bool fRet = false; 4286 if (hCurrentThread == NIL_RTTHREAD) 4287 hCurrentThread = RTThreadSelf(); 4288 else 4289 Assert(hCurrentThread == RTThreadSelf()); 4290 PRTTHREADINT pThread = rtThreadGet(hCurrentThread); 4291 if (pThread) 4292 { 4293 if (hClass != NIL_RTLOCKVALCLASS) 4294 { 4295 PRTLOCKVALRECUNION pCur = rtLockValidatorReadRecUnionPtr(&pThread->LockValidator.pStackTop); 4296 while (VALID_PTR(pCur) && !fRet) 4297 { 4298 switch (pCur->Core.u32Magic) 4299 { 4300 case RTLOCKVALRECEXCL_MAGIC: 4301 fRet = pCur->Excl.hClass == hClass; 4302 pCur = rtLockValidatorReadRecUnionPtr(&pCur->Excl.pDown); 4303 break; 4304 case RTLOCKVALRECSHRDOWN_MAGIC: 4305 fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec) 4306 && pCur->ShrdOwner.pSharedRec->hClass == hClass; 4307 pCur = rtLockValidatorReadRecUnionPtr(&pCur->ShrdOwner.pDown); 4308 break; 4309 case RTLOCKVALRECNEST_MAGIC: 4310 switch (pCur->Nest.pRec->Core.u32Magic) 4311 { 4312 case RTLOCKVALRECEXCL_MAGIC: 4313 fRet = pCur->Nest.pRec->Excl.hClass == hClass; 4314 break; 4315 case RTLOCKVALRECSHRDOWN_MAGIC: 4316 fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec) 4317 && pCur->Nest.pRec->ShrdOwner.pSharedRec->hClass == hClass; 4318 break; 4319 } 4320 pCur = rtLockValidatorReadRecUnionPtr(&pCur->Nest.pDown); 4321 break; 4322 default: 4323 pCur = NULL; 4324 break; 4325 } 4326 } 4327 } 4328 4329 rtThreadRelease(pThread); 4330 } 4331 return fRet; 4332 } 4333 RT_EXPORT_SYMBOL(RTLockValidatorHoldsLocksInClass); 4334 4335 4336 RTDECL(bool) RTLockValidatorHoldsLocksInSubClass(RTTHREAD hCurrentThread, RTLOCKVALCLASS hClass, uint32_t uSubClass) 4337 { 4338 bool fRet = false; 4339 if (hCurrentThread == NIL_RTTHREAD) 4340 hCurrentThread = RTThreadSelf(); 4341 else 4342 Assert(hCurrentThread == RTThreadSelf()); 4343 PRTTHREADINT pThread = rtThreadGet(hCurrentThread); 4344 if (pThread) 4345 { 4346 if (hClass != NIL_RTLOCKVALCLASS) 4347 { 4348 PRTLOCKVALRECUNION pCur = rtLockValidatorReadRecUnionPtr(&pThread->LockValidator.pStackTop); 4349 while (VALID_PTR(pCur) && !fRet) 4350 { 4351 switch (pCur->Core.u32Magic) 4352 { 4353 case RTLOCKVALRECEXCL_MAGIC: 4354 fRet = pCur->Excl.hClass == hClass 4355 && pCur->Excl.uSubClass == uSubClass; 4356 pCur = rtLockValidatorReadRecUnionPtr(&pCur->Excl.pDown); 4357 break; 4358 case RTLOCKVALRECSHRDOWN_MAGIC: 4359 fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec) 4360 && pCur->ShrdOwner.pSharedRec->hClass == hClass 4361 && pCur->ShrdOwner.pSharedRec->uSubClass == uSubClass; 4362 pCur = rtLockValidatorReadRecUnionPtr(&pCur->ShrdOwner.pDown); 4363 break; 4364 case RTLOCKVALRECNEST_MAGIC: 4365 switch (pCur->Nest.pRec->Core.u32Magic) 4366 { 4367 case RTLOCKVALRECEXCL_MAGIC: 4368 fRet = pCur->Nest.pRec->Excl.hClass == hClass 4369 && pCur->Nest.pRec->Excl.uSubClass == uSubClass; 4370 break; 4371 case RTLOCKVALRECSHRDOWN_MAGIC: 4372 fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec) 4373 && pCur->Nest.pRec->ShrdOwner.pSharedRec->hClass == hClass 4374 && pCur->Nest.pRec->ShrdOwner.pSharedRec->uSubClass == uSubClass; 4375 break; 4376 } 4377 pCur = rtLockValidatorReadRecUnionPtr(&pCur->Nest.pDown); 4378 break; 4379 default: 4380 pCur = NULL; 4381 break; 4382 } 4383 } 4384 } 4385 4386 rtThreadRelease(pThread); 4387 } 4388 return fRet; 4389 } 4390 RT_EXPORT_SYMBOL(RTLockValidatorHoldsLocksInClass); 4391 4392 4283 4393 RTDECL(bool) RTLockValidatorSetEnabled(bool fEnabled) 4284 4394 {
Note:
See TracChangeset
for help on using the changeset viewer.