Changeset 25622 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jan 3, 2010 1:56:34 PM (15 years ago)
- Location:
- trunk/src/VBox/Runtime/common/misc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
r25618 r25622 412 412 Assert(pPerThread->cWriteLocks == 0); 413 413 Assert(pPerThread->cReadLocks == 0); 414 Assert(pPerThread->fInValidator == false); 414 415 } 415 416 … … 1166 1167 rtLockValidatorWriteRecUnionPtr(&pThreadSelf->LockValidator.pRec, pRecU); 1167 1168 rtLockValidatorCopySrcPos(&pThreadSelf->LockValidator.SrcPos, pSrcPos); 1169 ASMAtomicWriteBool(&pThreadSelf->LockValidator.fInValidator, true); 1168 1170 rtThreadSetState(pThreadSelf, enmSleepState); 1169 1171 … … 1174 1176 * isn't any other place to check for this. semmutex-win.cpp for instance. 1175 1177 */ 1178 int rc = VINF_SUCCESS; 1176 1179 if (rtLockValidatorReadThreadHandle(&pRecU->Excl.hThread) == pThreadSelf) 1177 1180 { 1178 if (fRecursiveOk) 1179 return VINF_SUCCESS; 1180 rtLockValidatorComplainFirst("Recursion not allowed", pSrcPos, pThreadSelf, pRecU); 1181 rtLockValidatorComplainPanic(); 1181 if (!fRecursiveOk) 1182 { 1183 rtLockValidatorComplainFirst("Recursion not allowed", pSrcPos, pThreadSelf, pRecU); 1184 rtLockValidatorComplainPanic(); 1185 rc = VERR_SEM_LV_NESTED; 1186 } 1187 } 1188 /* 1189 * Perform deadlock detection. 1190 */ 1191 else if (!rtLockValidatorIsSimpleNoDeadlockCase(pRecU)) 1192 rc = rtLockValidatorDeadlockDetection(pRecU, pThreadSelf, pSrcPos); 1193 1194 if (RT_FAILURE(rc)) 1182 1195 rtThreadSetState(pThreadSelf, enmThreadState); 1183 return VERR_SEM_LV_NESTED; 1184 } 1185 1186 /* 1187 * Perform deadlock detection. 1188 */ 1189 int rc = VINF_SUCCESS; 1190 if (!rtLockValidatorIsSimpleNoDeadlockCase(pRecU)) 1191 { 1192 rc = rtLockValidatorDeadlockDetection(pRecU, pThreadSelf, pSrcPos); 1193 if (RT_FAILURE(rc)) 1194 rtThreadSetState(pThreadSelf, enmThreadState); 1195 } 1196 ASMAtomicWriteBool(&pThreadSelf->LockValidator.fInValidator, false); 1196 1197 return rc; 1197 1198 } … … 1365 1366 rtLockValidatorWriteRecUnionPtr(&pThreadSelf->LockValidator.pRec, pRecU); 1366 1367 rtLockValidatorCopySrcPos(&pThreadSelf->LockValidator.SrcPos, pSrcPos); 1368 ASMAtomicWriteBool(&pThreadSelf->LockValidator.fInValidator, true); 1367 1369 rtThreadSetState(pThreadSelf, enmSleepState); 1368 1370 … … 1370 1372 * Don't do deadlock detection if we're recursing. 1371 1373 */ 1374 int rc = VINF_SUCCESS; 1372 1375 PRTLOCKVALRECSHRDOWN pEntry = rtLockValidatorRecSharedFindOwner(&pRecU->Shared, pThreadSelf, NULL); 1373 1376 if (pEntry) 1374 1377 { 1375 if (fRecursiveOk) 1376 return VINF_SUCCESS; 1377 rtLockValidatorComplainFirst("Recursion not allowed", pSrcPos, pThreadSelf, pRecU); 1378 rtLockValidatorComplainPanic(); 1378 if (!fRecursiveOk) 1379 { 1380 rtLockValidatorComplainFirst("Recursion not allowed", pSrcPos, pThreadSelf, pRecU); 1381 rtLockValidatorComplainPanic(); 1382 rc = VERR_SEM_LV_NESTED; 1383 } 1384 } 1385 /* 1386 * Perform deadlock detection. 1387 */ 1388 else if (!rtLockValidatorIsSimpleNoDeadlockCase(pRecU)) 1389 rc = rtLockValidatorDeadlockDetection(pRecU, pThreadSelf, pSrcPos); 1390 1391 if (RT_FAILURE(rc)) 1379 1392 rtThreadSetState(pThreadSelf, enmThreadState); 1380 return VERR_SEM_LV_NESTED; 1381 } 1382 1383 /* 1384 * Perform deadlock detection. 1385 */ 1386 int rc = VINF_SUCCESS; 1387 if (!rtLockValidatorIsSimpleNoDeadlockCase(pRecU)) 1388 { 1389 rc = rtLockValidatorDeadlockDetection(pRecU, pThreadSelf, pSrcPos); 1390 if (RT_FAILURE(rc)) 1391 rtThreadSetState(pThreadSelf, enmThreadState); 1392 } 1393 ASMAtomicWriteBool(&pThreadSelf->LockValidator.fInValidator, false); 1393 1394 return rc; 1394 1395 } … … 1860 1861 1861 1862 1863 RTDECL(bool) RTLockValidatorIsBlockedThreadInValidator(RTTHREAD hThread) 1864 { 1865 bool fRet = false; 1866 PRTTHREADINT pThread = rtThreadGet(hThread); 1867 if (pThread) 1868 { 1869 fRet = ASMAtomicReadBool(&pThread->LockValidator.fInValidator); 1870 rtThreadRelease(pThread); 1871 } 1872 return fRet; 1873 } 1874 RT_EXPORT_SYMBOL(RTLockValidatorIsBlockedThreadInValidator); 1875 1876 1862 1877 RTDECL(bool) RTLockValidatorSetEnabled(bool fEnabled) 1863 1878 { -
trunk/src/VBox/Runtime/common/misc/thread.cpp
r25618 r25622 1305 1305 Assert(RTTHREAD_IS_SLEEPING(enmState)); 1306 1306 PRTTHREADINT pThread = hThread; 1307 if ( hThread && rtThreadGetState(pThread) == RTTHREADSTATE_RUNNING)1307 if (pThread && rtThreadGetState(pThread) == RTTHREADSTATE_RUNNING) 1308 1308 rtThreadSetState(pThread, enmState); 1309 1309 }
Note:
See TracChangeset
for help on using the changeset viewer.