Changeset 25685 in vbox
- Timestamp:
- Jan 7, 2010 10:03:06 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56405
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/critsect.h
r25645 r25685 102 102 /** If set, nesting(/recursion) is not allowed. */ 103 103 #define RTCRITSECT_FLAGS_NO_NESTING UINT32_C(0x00000001) 104 /** Disables lock validation. */ 105 #define RTCRITSECT_FLAGS_NO_LOCK_VAL UINT32_C(0x00000002) 104 106 105 107 #ifdef IN_RING3 … … 114 116 * 115 117 * @returns iprt status code. 116 * @param pCritSect Pointer to the critical section structure. 117 * @param fFlags Flags, any combination of the RTCRITSECT_FLAGS \#defines. 118 */ 119 RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags); 118 * @param pCritSect Pointer to the critical section structure. 119 * @param fFlags Flags, any combination of the RTCRITSECT_FLAGS 120 * \#defines. 121 * @param hClass The class (no reference consumed). If NIL, the 122 * no lock order validation will be performed on 123 * this lock. 124 * @param uSubClass The sub-class. This is used to define lock 125 * order inside the same class. If you don't know, 126 * then pass RTLOCKVAL_SUB_CLASS_NONE. 127 * @param pszName The lock name (optional). 128 */ 129 RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags, 130 RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszName); 120 131 121 132 /** … … 125 136 * @returns VERR_SEM_NESTED if nested enter on a no nesting section. (Asserted.) 126 137 * @returns VERR_SEM_DESTROYED if RTCritSectDelete was called while waiting. 127 * @param pCritSect The critical section.138 * @param pCritSect The critical section. 128 139 */ 129 140 RTDECL(int) RTCritSectEnter(PRTCRITSECT pCritSect); -
trunk/include/iprt/lockvalidator.h
r25682 r25685 241 241 242 242 243 /** @name Special sub-class values.244 * The range 16..UINT32_MAX is available to the user, the range 0..15 is245 * reserved for the lock validator.246 * @{ */247 /** Not allowed to be taken with any other locks in the same class.248 * This is the recommended value. */249 #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(0)250 /** Any order is allowed within the class. */251 #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(1)252 /** The first user value. */253 #define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)254 /** @} */255 256 243 /** 257 244 * Makes the two records siblings. … … 278 265 * @param pszName The lock name (optional). 279 266 * @param hLock The lock handle. 280 */ 281 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, 282 uint32_t uSubClass, const char *pszName, void *hLock); 267 * @param fEnabled Pass @c false to explicitly disable lock 268 * validation, otherwise @c true. 269 */ 270 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 271 const char *pszName, void *hLock, bool fEnabled); 283 272 /** 284 273 * Uninitialize a lock validator record previously initialized by … … 305 294 * @param pszName The lock name (optional). 306 295 * @param hLock The lock handle. 307 */ 308 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, 309 uint32_t uSubClass, const char *pszName, void *hLock); 296 * @param fEnabled Pass @c false to explicitly disable lock 297 * validation, otherwise @c true. 298 */ 299 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 300 const char *pszName, void *hLock, bool fEnabled); 310 301 311 302 /** … … 441 432 * pass NIL_RTTHREAD and we'll figure it out. 442 433 * @param pSrcPos The source position of the lock operation. 443 */ 444 RTDECL(int) RTLockValidatorRecExclCheckOrder(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, PCRTLOCKVALSRCPOS pSrcPos); 434 * @param cMillies The timeout, in milliseconds. 435 */ 436 RTDECL(int) RTLockValidatorRecExclCheckOrder(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, 437 PCRTLOCKVALSRCPOS pSrcPos, RTMSINTERVAL cMillies); 445 438 446 439 /** … … 462 455 * @param pSrcPos The source position of the lock operation. 463 456 * @param fRecursiveOk Whether it's ok to recurse. 457 * @param cMillies The timeout, in milliseconds. 464 458 * @param enmSleepState The sleep state to enter on successful return. 465 459 * @param fReallySleeping Is it really going to sleep now or not. Use … … 468 462 */ 469 463 RTDECL(int) RTLockValidatorRecExclCheckBlocking(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, 470 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 464 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 471 465 RTTHREADSTATE enmSleepState, bool fReallySleeping); 472 466 … … 480 474 * @param pSrcPos The source position of the lock operation. 481 475 * @param fRecursiveOk Whether it's ok to recurse. 476 * @param cMillies The timeout, in milliseconds. 482 477 * @param enmSleepState The sleep state to enter on successful return. 483 478 * @param fReallySleeping Is it really going to sleep now or not. Use … … 486 481 */ 487 482 RTDECL(int) RTLockValidatorRecExclCheckOrderAndBlocking(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, 488 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 483 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 489 484 RTTHREADSTATE enmSleepState, bool fReallySleeping); 490 485 … … 506 501 * applied to this record, clear if read-write 507 502 * semaphore logic should be used. 503 * @param fEnabled Pass @c false to explicitly disable lock 504 * validation, otherwise @c true. 508 505 */ 509 506 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 510 const char *pszName, void *hLock, bool fSignaller );507 const char *pszName, void *hLock, bool fSignaller, bool fEnabled); 511 508 /** 512 509 * Uninitialize a lock validator record previously initialized by … … 532 529 * @param pSrcPos The source position of the lock operation. 533 530 */ 534 RTDECL(int) RTLockValidatorRecSharedCheckOrder(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, PCRTLOCKVALSRCPOS pSrcPos); 531 RTDECL(int) RTLockValidatorRecSharedCheckOrder(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, 532 PCRTLOCKVALSRCPOS pSrcPos, RTMSINTERVAL cMillies); 535 533 536 534 /** … … 558 556 */ 559 557 RTDECL(int) RTLockValidatorRecSharedCheckBlocking(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, 560 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 558 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 561 559 RTTHREADSTATE enmSleepState, bool fReallySleeping); 562 560 … … 576 574 */ 577 575 RTDECL(int) RTLockValidatorRecSharedCheckOrderAndBlocking(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, 578 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 576 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 579 577 RTTHREADSTATE enmSleepState, bool fReallySleeping); 580 578 … … 731 729 * itself new locking order rules (true), or if the 732 730 * user will teach it all it needs to know (false). 731 * @param fRecursionOk Whether to allow lock recursion or not. 733 732 * @param cMsMinDeadlock Used to raise the sleep interval at which 734 733 * deadlock detection kicks in. Minimum is 1 ms, … … 737 736 * order validation kicks in. Minimum is 1 ms, 738 737 * while RT_INDEFINITE_WAIT will disable it. 738 * 739 * @remarks The properties can be modified after creation by the 740 * RTLockValidatorClassSet* methods. 739 741 */ 740 742 RTDECL(int) RTLockValidatorClassCreateEx(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRCPOS pSrcPos, 741 bool fAutodidact, RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder); 743 bool fAutodidact, bool fRecursionOk, 744 RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder); 742 745 743 746 /** -
trunk/include/iprt/types.h
r25682 r25685 1495 1495 typedef struct RTLOCKVALSRCPOS const *PCRTLOCKVALSRCPOS; 1496 1496 1497 /** @name Special sub-class values. 1498 * The range 16..UINT32_MAX is available to the user, the range 0..15 is 1499 * reserved for the lock validator. 1500 * @{ */ 1501 /** Not allowed to be taken with any other locks in the same class. 1502 * This is the recommended value. */ 1503 #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(0) 1504 /** Any order is allowed within the class. */ 1505 #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(1) 1506 /** The first user value. */ 1507 #define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16) 1508 /** @} */ 1509 1497 1510 1498 1511 #ifdef __cplusplus -
trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
r25684 r25685 138 138 /** Whether the class is allowed to teach it self new locking order rules. */ 139 139 bool fAutodidact; 140 /** Whether to allow recursion. */ 141 bool fRecursionOk; 142 /** Reserved. */ 143 bool fReserved; 140 144 /** Whether this class is in the tree. */ 141 145 bool fInTree; 142 bool afReserved[2]; /**< Explicit padding */143 146 /** The minimum wait interval for which we do deadlock detection 144 147 * (milliseconds). */ … … 272 275 ASMAtomicWriteU32(&s_fInitializing, false); 273 276 } 274 else275 RTThreadYield();276 277 } 277 278 … … 648 649 649 650 RTDECL(int) RTLockValidatorClassCreateEx(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRCPOS pSrcPos, 650 bool fAutodidact, RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder) 651 bool fAutodidact, bool fRecursionOk, 652 RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder) 651 653 { 652 654 Assert(cMsMinDeadlock >= 1); … … 668 670 pThis->cRefs = 1; 669 671 pThis->fAutodidact = fAutodidact; 672 pThis->fRecursionOk = fRecursionOk; 673 pThis->fReserved = false; 670 674 pThis->fInTree = false; 671 for (unsigned i = 0; i < RT_ELEMENTS(pThis->afReserved); i++)672 pThis->afReserved[i] = false;673 675 pThis->cMsMinDeadlock = cMsMinDeadlock; 674 676 pThis->cMsMinOrder = cMsMinOrder; … … 702 704 { 703 705 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_POS_NO_ID(); 704 return RTLockValidatorClassCreateEx(phClass, &SrcPos, fAutodidact, 706 return RTLockValidatorClassCreateEx(phClass, &SrcPos, 707 fAutodidact, true /*fRecursionOk*/, 705 708 1 /*cMsMinDeadlock*/, 1 /*cMsMinOrder*/); 706 709 } … … 821 824 * Create a new class and insert it into the tree. 822 825 */ 823 int rc = RTLockValidatorClassCreateEx(&hClass, &SrcPos, true /*fAutodidact*/, 826 int rc = RTLockValidatorClassCreateEx(&hClass, &SrcPos, 827 true /*fAutodidact*/, true /*fRecursionOk*/, 824 828 1 /*cMsMinDeadlock*/, 1 /*cMsMinOrder*/); 825 829 if (RT_SUCCESS(rc)) … … 1022 1026 1023 1027 return rtLockValidatorClassAddPriorClass(pClass, pPriorClass, false /*fAutodidacticism*/); 1028 } 1029 1030 1031 static void rtLockValidatorStackPush(PRTTHREADINT pThreadSelf, PRTLOCKVALRECUNION pRec, PCRTLOCKVALSRCPOS pSrcPos) 1032 { 1033 Assert(pThreadSelf == RTThreadSelf()); 1034 1035 } 1036 1037 1038 static void rtLockValidatorStackPop(PRTTHREADINT pThreadSelf, PRTLOCKVALRECUNION pRec) 1039 { 1040 Assert(pThreadSelf == RTThreadSelf()); 1041 1042 } 1043 1044 1045 static void rtLockValidatorStackPushRecursion(PRTTHREADINT pThreadSelf, PRTLOCKVALRECUNION pRec, PCRTLOCKVALSRCPOS pSrcPos) 1046 { 1047 Assert(pThreadSelf == RTThreadSelf()); 1048 /** @todo insert a recursion record onto the stack. Keep a reasonally big pool 1049 * of them associated with each thread. */ 1050 } 1051 1052 1053 static void rtLockValidatorStackPopRecursion(PRTTHREADINT pThreadSelf, PRTLOCKVALRECUNION pRec) 1054 { 1055 Assert(pThreadSelf == RTThreadSelf()); 1056 1057 } 1058 1059 1060 static int rtLockValidatorCheckOrderOnRequest(RTLOCKVALCLASS hClass, uint32_t uSubClass, RTTHREAD hThreadSelf, 1061 PRTLOCKVALRECUNION pRec, PCRTLOCKVALSRCPOS pSrcPos) 1062 { 1063 /** @todo Lock Order Validation: request */ 1064 return VINF_SUCCESS; 1065 } 1066 1067 1068 static int rtLockValidatorCheckOrderOnRelease(RTLOCKVALCLASS hClass, uint32_t uSubClass, RTTHREAD hThreadSelf, 1069 PRTLOCKVALRECUNION pRec) 1070 { 1071 /** @todo Lock Order Validation: release, maybe */ 1072 return VINF_SUCCESS; 1024 1073 } 1025 1074 … … 1564 1613 1565 1614 1566 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, 1567 uint32_t uSubClass, const char *pszName, void *hLock)1615 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 1616 const char *pszName, void *hLock, bool fEnabled) 1568 1617 { 1569 1618 RTLOCKVAL_ASSERT_PTR_ALIGN(pRec); … … 1571 1620 1572 1621 pRec->Core.u32Magic = RTLOCKVALRECEXCL_MAGIC; 1573 pRec->fEnabled = RTLockValidatorIsEnabled();1622 pRec->fEnabled = fEnabled && RTLockValidatorIsEnabled(); 1574 1623 pRec->afReserved[0] = 0; 1575 1624 pRec->afReserved[1] = 0; … … 1592 1641 1593 1642 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, 1594 uint32_t uSubClass, const char *pszName, void *pvLock )1643 uint32_t uSubClass, const char *pszName, void *pvLock, bool fEnabled) 1595 1644 { 1596 1645 PRTLOCKVALRECEXCL pRec; … … 1599 1648 return VERR_NO_MEMORY; 1600 1649 1601 RTLockValidatorRecExclInit(pRec, hClass, uSubClass, pszName, pvLock );1650 RTLockValidatorRecExclInit(pRec, hClass, uSubClass, pszName, pvLock, fEnabled); 1602 1651 1603 1652 return VINF_SUCCESS; … … 1635 1684 PCRTLOCKVALSRCPOS pSrcPos, bool fFirstRecursion) 1636 1685 { 1637 AssertReturnVoid(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC); 1638 if (!pRec->fEnabled) 1686 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1687 AssertReturnVoid(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC); 1688 if (!pRecU->Excl.fEnabled) 1639 1689 return; 1640 1690 if (hThreadSelf == NIL_RTTHREAD) … … 1647 1697 ASMAtomicIncS32(&hThreadSelf->LockValidator.cWriteLocks); 1648 1698 1649 if (pRec ->hThread == hThreadSelf)1699 if (pRecU->Excl.hThread == hThreadSelf) 1650 1700 { 1651 1701 Assert(!fFirstRecursion); 1652 pRec->cRecursion++; 1702 pRecU->Excl.cRecursion++; 1703 rtLockValidatorStackPushRecursion(hThreadSelf, pRecU, pSrcPos); 1653 1704 } 1654 1705 else 1655 1706 { 1656 Assert(pRec->hThread == NIL_RTTHREAD); 1657 1658 /* 1659 * Update the record. 1660 */ 1661 rtLockValidatorSrcPosCopy(&pRec->SrcPos, pSrcPos); 1662 ASMAtomicUoWriteU32(&pRec->cRecursion, 1); 1663 ASMAtomicWriteHandle(&pRec->hThread, hThreadSelf); 1664 1665 /* 1666 * Push the lock onto the lock stack. 1667 */ 1668 /** @todo push it onto the per-thread lock stack. */ 1669 } 1670 } 1671 1672 1673 RTDECL(int) RTLockValidatorRecExclReleaseOwner(PRTLOCKVALRECEXCL pRec, bool fFinalRecursion) 1674 { 1675 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1676 if (!pRec->fEnabled) 1677 return VINF_SUCCESS; 1678 AssertReturn(pRec->hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER); 1679 1680 RTLockValidatorRecExclReleaseOwnerUnchecked(pRec); 1681 return VINF_SUCCESS; 1682 } 1683 1684 1685 RTDECL(void) RTLockValidatorRecExclReleaseOwnerUnchecked(PRTLOCKVALRECEXCL pRec) 1686 { 1687 AssertReturnVoid(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC); 1688 if (!pRec->fEnabled) 1689 return; 1690 RTTHREADINT *pThread = pRec->hThread; 1707 Assert(pRecU->Excl.hThread == NIL_RTTHREAD); 1708 1709 rtLockValidatorSrcPosCopy(&pRecU->Excl.SrcPos, pSrcPos); 1710 ASMAtomicUoWriteU32(&pRecU->Excl.cRecursion, 1); 1711 ASMAtomicWriteHandle(&pRecU->Excl.hThread, hThreadSelf); 1712 1713 rtLockValidatorStackPush(hThreadSelf, pRecU, pSrcPos); 1714 } 1715 } 1716 1717 1718 /** 1719 * Internal worker for RTLockValidatorRecExclReleaseOwner and 1720 * RTLockValidatorRecExclReleaseOwnerUnchecked. 1721 */ 1722 static void rtLockValidatorRecExclReleaseOwnerUnchecked(PRTLOCKVALRECUNION pRec, bool fFinalRecursion) 1723 { 1724 RTTHREADINT *pThread = pRec->Excl.hThread; 1691 1725 AssertReturnVoid(pThread != NIL_RTTHREAD); 1692 1726 Assert(pThread == RTThreadSelf()); 1693 1727 1694 1728 ASMAtomicDecS32(&pThread->LockValidator.cWriteLocks); 1695 1696 if (ASMAtomicDecU32(&pRec->cRecursion) == 0) 1697 { 1698 /* 1699 * Pop (remove) the lock. 1700 */ 1701 /** @todo remove it from the per-thread stack/whatever. */ 1702 1703 /* 1704 * Update the record. 1705 */ 1706 ASMAtomicWriteHandle(&pRec->hThread, NIL_RTTHREAD); 1707 } 1729 uint32_t c = ASMAtomicDecU32(&pRec->Excl.cRecursion); 1730 if (c == 0) 1731 { 1732 rtLockValidatorStackPopRecursion(pThread, pRec); 1733 ASMAtomicWriteHandle(&pRec->Excl.hThread, NIL_RTTHREAD); 1734 } 1735 else 1736 { 1737 Assert(c < UINT32_C(0xffff0000)); 1738 Assert(!fFinalRecursion); 1739 rtLockValidatorStackPopRecursion(pThread, pRec); 1740 } 1741 } 1742 1743 RTDECL(int) RTLockValidatorRecExclReleaseOwner(PRTLOCKVALRECEXCL pRec, bool fFinalRecursion) 1744 { 1745 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1746 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1747 if (pRecU->Excl.fEnabled) 1748 rtLockValidatorRecExclReleaseOwnerUnchecked(pRecU, fFinalRecursion); 1749 return VINF_SUCCESS; 1750 } 1751 1752 1753 RTDECL(void) RTLockValidatorRecExclReleaseOwnerUnchecked(PRTLOCKVALRECEXCL pRec) 1754 { 1755 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1756 AssertReturnVoid(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC); 1757 if (pRecU->Excl.fEnabled) 1758 rtLockValidatorRecExclReleaseOwnerUnchecked(pRecU, false); 1708 1759 } 1709 1760 … … 1711 1762 RTDECL(int) RTLockValidatorRecExclRecursion(PRTLOCKVALRECEXCL pRec, PCRTLOCKVALSRCPOS pSrcPos) 1712 1763 { 1713 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1714 if (!pRec->fEnabled) 1764 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1765 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1766 if (!pRecU->Excl.fEnabled) 1715 1767 return VINF_SUCCESS; 1716 AssertReturn(pRec->hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER); 1717 1718 Assert(pRec->cRecursion < _1M); 1719 pRec->cRecursion++; 1720 1768 AssertReturn(pRecU->Excl.hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER); 1769 AssertReturn(pRecU->Excl.cRecursion > 0, VERR_SEM_LV_INVALID_PARAMETER); 1770 1771 if ( pRecU->Excl.hClass != NIL_RTLOCKVALCLASS 1772 && !pRecU->Excl.hClass->fRecursionOk) 1773 { 1774 rtLockValidatorComplainFirst("Recursion not allowed by the class", 1775 pSrcPos, pRecU->Excl.hThread, (PRTLOCKVALRECUNION)pRec); 1776 rtLockValidatorComplainPanic(); 1777 return VERR_SEM_LV_NESTED; 1778 } 1779 1780 Assert(pRecU->Excl.cRecursion < _1M); 1781 pRecU->Excl.cRecursion++; 1782 rtLockValidatorStackPush(pRecU->Excl.hThread, pRecU, pSrcPos); 1721 1783 return VINF_SUCCESS; 1722 1784 } … … 1725 1787 RTDECL(int) RTLockValidatorRecExclUnwind(PRTLOCKVALRECEXCL pRec) 1726 1788 { 1727 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1728 if (!pRec->fEnabled) 1789 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1790 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1791 if (!pRecU->Excl.fEnabled) 1729 1792 return VINF_SUCCESS; 1730 AssertReturn(pRec ->hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER);1731 AssertReturn(pRec ->cRecursion > 0, VERR_SEM_LV_INVALID_PARAMETER);1732 1733 Assert(pRec->cRecursion);1734 pRec ->cRecursion--;1793 AssertReturn(pRecU->Excl.hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER); 1794 AssertReturn(pRecU->Excl.cRecursion > 1, VERR_SEM_LV_INVALID_PARAMETER); 1795 1796 rtLockValidatorStackPop(pRecU->Excl.hThread, pRecU); 1797 pRecU->Excl.cRecursion--; 1735 1798 return VINF_SUCCESS; 1736 1799 } … … 1739 1802 RTDECL(int) RTLockValidatorRecExclRecursionMixed(PRTLOCKVALRECEXCL pRec, PRTLOCKVALRECCORE pRecMixed, PCRTLOCKVALSRCPOS pSrcPos) 1740 1803 { 1741 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1804 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1805 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1742 1806 PRTLOCKVALRECUNION pRecMixedU = (PRTLOCKVALRECUNION)pRecMixed; 1743 1807 AssertReturn( pRecMixedU->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC 1744 1808 || pRecMixedU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC 1745 1809 , VERR_SEM_LV_INVALID_PARAMETER); 1746 if (!pRec ->fEnabled)1810 if (!pRecU->Excl.fEnabled) 1747 1811 return VINF_SUCCESS; 1748 AssertReturn(pRec->hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER); 1749 AssertReturn(pRec->cRecursion > 0, VERR_SEM_LV_INVALID_PARAMETER); 1750 1751 Assert(pRec->cRecursion < _1M); 1752 pRec->cRecursion++; 1812 AssertReturn(pRecU->Excl.hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER); 1813 AssertReturn(pRecU->Excl.cRecursion > 0, VERR_SEM_LV_INVALID_PARAMETER); 1814 1815 if ( pRecU->Excl.hClass != NIL_RTLOCKVALCLASS 1816 && !pRecU->Excl.hClass->fRecursionOk) 1817 { 1818 rtLockValidatorComplainFirst("Mixed recursion not allowed by the class", 1819 pSrcPos, pRecU->Excl.hThread, (PRTLOCKVALRECUNION)pRec); 1820 rtLockValidatorComplainPanic(); 1821 return VERR_SEM_LV_NESTED; 1822 } 1823 1824 Assert(pRecU->Excl.cRecursion < _1M); 1825 pRecU->Excl.cRecursion++; 1826 rtLockValidatorStackPushRecursion(pRecU->Excl.hThread, pRecU, pSrcPos); 1753 1827 1754 1828 return VINF_SUCCESS; … … 1758 1832 RTDECL(int) RTLockValidatorRecExclUnwindMixed(PRTLOCKVALRECEXCL pRec, PRTLOCKVALRECCORE pRecMixed) 1759 1833 { 1760 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1834 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1835 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1761 1836 PRTLOCKVALRECUNION pRecMixedU = (PRTLOCKVALRECUNION)pRecMixed; 1762 1837 AssertReturn( pRecMixedU->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC 1763 1838 || pRecMixedU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC 1764 1839 , VERR_SEM_LV_INVALID_PARAMETER); 1765 if (!pRec ->fEnabled)1840 if (!pRecU->Excl.fEnabled) 1766 1841 return VINF_SUCCESS; 1767 AssertReturn(pRec ->hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER);1768 AssertReturn(pRec ->cRecursion > 0, VERR_SEM_LV_INVALID_PARAMETER);1769 1770 Assert(pRec->cRecursion);1771 pRec ->cRecursion--;1842 AssertReturn(pRecU->Excl.hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER); 1843 AssertReturn(pRecU->Excl.cRecursion > 1, VERR_SEM_LV_INVALID_PARAMETER); 1844 1845 rtLockValidatorStackPopRecursion(pRecU->Excl.hThread, pRecU); 1846 pRecU->Excl.cRecursion--; 1772 1847 return VINF_SUCCESS; 1773 1848 } 1774 1849 1775 1850 1776 RTDECL(int) RTLockValidatorRecExclCheckOrder(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, PCRTLOCKVALSRCPOS pSrcPos) 1777 { 1778 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1779 if (!pRec->fEnabled) 1851 RTDECL(int) RTLockValidatorRecExclCheckOrder(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, 1852 PCRTLOCKVALSRCPOS pSrcPos, RTMSINTERVAL cMillies) 1853 { 1854 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1855 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1856 if ( !pRecU->Excl.fEnabled 1857 || pRecU->Excl.hClass == NIL_RTLOCKVALCLASS 1858 || pRecU->Excl.hClass->cMsMinOrder == RT_INDEFINITE_WAIT 1859 || pRecU->Excl.hClass->cMsMinOrder > cMillies) 1780 1860 return VINF_SUCCESS; 1781 1861 1782 /* 1783 * Check it locks we're currently holding. 1784 */ 1785 /** @todo later */ 1786 1787 /* 1788 * If missing order rules, add them. 1789 */ 1790 1791 return VINF_SUCCESS; 1862 return rtLockValidatorCheckOrderOnRequest(pRecU->Excl.hClass, pRecU->Excl.uSubClass, hThreadSelf, pRecU, pSrcPos); 1792 1863 } 1793 1864 1794 1865 1795 1866 RTDECL(int) RTLockValidatorRecExclCheckBlocking(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, 1796 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 1867 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 1797 1868 RTTHREADSTATE enmSleepState, bool fReallySleeping) 1798 1869 { … … 1803 1874 AssertPtrReturn(pRecU, VERR_SEM_LV_INVALID_PARAMETER); 1804 1875 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1805 if (!pRec U->Excl.fEnabled)1876 if (!pRec->fEnabled) 1806 1877 return VINF_SUCCESS; 1807 1878 … … 1840 1911 if (rtLockValidatorReadThreadHandle(&pRecU->Excl.hThread) == pThreadSelf) 1841 1912 { 1842 if (!fRecursiveOk) 1913 if ( !fRecursiveOk 1914 || ( pRecU->Excl.hClass != NIL_RTLOCKVALCLASS 1915 && !pRecU->Excl.hClass->fRecursionOk)) 1843 1916 { 1844 1917 rtLockValidatorComplainFirst("Recursion not allowed", pSrcPos, pThreadSelf, pRecU); … … 1850 1923 * Perform deadlock detection. 1851 1924 */ 1925 else if ( pRecU->Excl.hClass != NIL_RTLOCKVALCLASS 1926 && ( pRecU->Excl.hClass->cMsMinDeadlock > cMillies 1927 || pRecU->Excl.hClass->cMsMinDeadlock > RT_INDEFINITE_WAIT)) 1928 rc = VINF_SUCCESS; 1852 1929 else if (!rtLockValidatorIsSimpleNoDeadlockCase(pRecU)) 1853 1930 rc = rtLockValidatorDeadlockDetection(pRecU, pThreadSelf, pSrcPos); … … 1867 1944 1868 1945 RTDECL(int) RTLockValidatorRecExclCheckOrderAndBlocking(PRTLOCKVALRECEXCL pRec, RTTHREAD hThreadSelf, 1869 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 1946 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 1870 1947 RTTHREADSTATE enmSleepState, bool fReallySleeping) 1871 1948 { 1872 int rc = RTLockValidatorRecExclCheckOrder(pRec, hThreadSelf, pSrcPos );1949 int rc = RTLockValidatorRecExclCheckOrder(pRec, hThreadSelf, pSrcPos, cMillies); 1873 1950 if (RT_SUCCESS(rc)) 1874 rc = RTLockValidatorRecExclCheckBlocking(pRec, hThreadSelf, pSrcPos, fRecursiveOk, enmSleepState, fReallySleeping); 1951 rc = RTLockValidatorRecExclCheckBlocking(pRec, hThreadSelf, pSrcPos, fRecursiveOk, cMillies, 1952 enmSleepState, fReallySleeping); 1875 1953 return rc; 1876 1954 } … … 1879 1957 1880 1958 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 1881 const char *pszName, void *hLock, bool fSignaller )1959 const char *pszName, void *hLock, bool fSignaller, bool fEnabled) 1882 1960 { 1883 1961 RTLOCKVAL_ASSERT_PTR_ALIGN(pRec); … … 1889 1967 pRec->hLock = hLock; 1890 1968 pRec->pszName = pszName; 1891 pRec->fEnabled = RTLockValidatorIsEnabled();1969 pRec->fEnabled = fEnabled && RTLockValidatorIsEnabled(); 1892 1970 pRec->fSignaller = fSignaller; 1893 1971 pRec->pSibling = NULL; … … 1951 2029 * Optional. 1952 2030 */ 1953 DECLINLINE(PRTLOCKVALREC SHRDOWN)2031 DECLINLINE(PRTLOCKVALRECUNION) 1954 2032 rtLockValidatorRecSharedFindOwner(PRTLOCKVALRECSHRD pShared, RTTHREAD hThread, uint32_t *piEntry) 1955 2033 { … … 1962 2040 for (uint32_t iEntry = 0; iEntry < cMax; iEntry++) 1963 2041 { 1964 PRTLOCKVALREC SHRDOWN pEntry =rtLockValidatorUoReadSharedOwner(&papOwners[iEntry]);1965 if (pEntry && pEntry-> hThread == hThread)2042 PRTLOCKVALRECUNION pEntry = (PRTLOCKVALRECUNION)rtLockValidatorUoReadSharedOwner(&papOwners[iEntry]); 2043 if (pEntry && pEntry->ShrdOwner.hThread == hThread) 1966 2044 { 1967 2045 rtLockValidatorSerializeDetectionLeave(); … … 1978 2056 1979 2057 1980 RTDECL(int) RTLockValidatorRecSharedCheckOrder(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, PCRTLOCKVALSRCPOS pSrcPos) 1981 { 1982 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1983 if (!pRec->fEnabled) 2058 RTDECL(int) RTLockValidatorRecSharedCheckOrder(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, PCRTLOCKVALSRCPOS pSrcPos, RTMSINTERVAL cMillies) 2059 { 2060 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 2061 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 2062 if ( !pRecU->Shared.fEnabled 2063 || pRecU->Shared.hClass == NIL_RTLOCKVALCLASS 2064 || pRecU->Shared.hClass->cMsMinOrder == RT_INDEFINITE_WAIT 2065 || pRecU->Shared.hClass->cMsMinOrder > cMillies 2066 ) 1984 2067 return VINF_SUCCESS; 1985 2068 Assert(hThreadSelf == NIL_RTTHREAD || hThreadSelf == RTThreadSelf()); 1986 2069 1987 /* 1988 * Check it locks we're currently holding. 1989 */ 1990 /** @todo later */ 1991 1992 /* 1993 * If missing order rules, add them. 1994 */ 1995 1996 return VINF_SUCCESS; 2070 return rtLockValidatorCheckOrderOnRequest(pRecU->Shared.hClass, pRecU->Shared.uSubClass, hThreadSelf, pRecU, pSrcPos); 1997 2071 } 1998 2072 1999 2073 2000 2074 RTDECL(int) RTLockValidatorRecSharedCheckBlocking(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, 2001 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 2075 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 2002 2076 RTTHREADSTATE enmSleepState, bool fReallySleeping) 2003 2077 { … … 2040 2114 */ 2041 2115 int rc = VINF_SUCCESS; 2042 PRTLOCKVALREC SHRDOWN pEntry = !pRecU->Shared.fSignaller2043 2044 2116 PRTLOCKVALRECUNION pEntry = !pRecU->Shared.fSignaller 2117 ? rtLockValidatorRecSharedFindOwner(&pRecU->Shared, pThreadSelf, NULL) 2118 : NULL; 2045 2119 if (pEntry) 2046 2120 { 2047 if (!fRecursiveOk) 2121 if ( !fRecursiveOk 2122 || ( pRec->hClass 2123 && !pRec->hClass->fRecursionOk) 2124 ) 2048 2125 { 2049 2126 rtLockValidatorComplainFirst("Recursion not allowed", pSrcPos, pThreadSelf, pRecU); … … 2055 2132 * Perform deadlock detection. 2056 2133 */ 2134 else if ( pRec->hClass 2135 && ( pRec->hClass->cMsMinDeadlock == RT_INDEFINITE_WAIT 2136 || pRec->hClass->cMsMinDeadlock > cMillies)) 2137 rc = VINF_SUCCESS; 2057 2138 else if (!rtLockValidatorIsSimpleNoDeadlockCase(pRecU)) 2058 2139 rc = rtLockValidatorDeadlockDetection(pRecU, pThreadSelf, pSrcPos); … … 2072 2153 2073 2154 RTDECL(int) RTLockValidatorRecSharedCheckOrderAndBlocking(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf, 2074 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, 2155 PCRTLOCKVALSRCPOS pSrcPos, bool fRecursiveOk, RTMSINTERVAL cMillies, 2075 2156 RTTHREADSTATE enmSleepState, bool fReallySleeping) 2076 2157 { 2077 int rc = RTLockValidatorRecSharedCheckOrder(pRec, hThreadSelf, pSrcPos );2158 int rc = RTLockValidatorRecSharedCheckOrder(pRec, hThreadSelf, pSrcPos, cMillies); 2078 2159 if (RT_SUCCESS(rc)) 2079 rc = RTLockValidatorRecSharedCheckBlocking(pRec, hThreadSelf, pSrcPos, fRecursiveOk, enmSleepState, fReallySleeping); 2160 rc = RTLockValidatorRecSharedCheckBlocking(pRec, hThreadSelf, pSrcPos, fRecursiveOk, cMillies, 2161 enmSleepState, fReallySleeping); 2080 2162 return rc; 2081 2163 } … … 2092 2174 * @param pSrcPos The source position. 2093 2175 */ 2094 DECLINLINE(PRTLOCKVALREC SHRDOWN)2176 DECLINLINE(PRTLOCKVALRECUNION) 2095 2177 rtLockValidatorRecSharedAllocOwner(PRTLOCKVALRECSHRD pRec, PRTTHREADINT pThreadSelf, PCRTLOCKVALSRCPOS pSrcPos) 2096 2178 { 2097 PRTLOCKVALREC SHRDOWN pEntry;2179 PRTLOCKVALRECUNION pEntry; 2098 2180 2099 2181 /* … … 2105 2187 && ASMAtomicBitTestAndClear(&pThreadSelf->LockValidator.bmFreeShrdOwners, iEntry - 1)) 2106 2188 { 2107 pEntry = &pThreadSelf->LockValidator.aShrdOwners[iEntry - 1];2108 Assert(!pEntry-> fReserved);2109 pEntry-> fStaticAlloc = true;2189 pEntry = (PRTLOCKVALRECUNION)&pThreadSelf->LockValidator.aShrdOwners[iEntry - 1]; 2190 Assert(!pEntry->ShrdOwner.fReserved); 2191 pEntry->ShrdOwner.fStaticAlloc = true; 2110 2192 rtThreadGet(pThreadSelf); 2111 2193 } 2112 2194 else 2113 2195 { 2114 pEntry = (PRTLOCKVALREC SHRDOWN)RTMemAlloc(sizeof(RTLOCKVALRECSHRDOWN));2196 pEntry = (PRTLOCKVALRECUNION)RTMemAlloc(sizeof(RTLOCKVALRECSHRDOWN)); 2115 2197 if (RT_UNLIKELY(!pEntry)) 2116 2198 return NULL; 2117 pEntry-> fStaticAlloc = false;2118 } 2119 2120 pEntry->Core.u32Magic = RTLOCKVALRECSHRDOWN_MAGIC;2121 pEntry-> cRecursion= 1;2122 pEntry-> fReserved= true;2123 pEntry-> hThread= pThreadSelf;2124 pEntry-> pDown= NULL;2125 pEntry-> pSharedRec= pRec;2199 pEntry->ShrdOwner.fStaticAlloc = false; 2200 } 2201 2202 pEntry->Core.u32Magic = RTLOCKVALRECSHRDOWN_MAGIC; 2203 pEntry->ShrdOwner.cRecursion = 1; 2204 pEntry->ShrdOwner.fReserved = true; 2205 pEntry->ShrdOwner.hThread = pThreadSelf; 2206 pEntry->ShrdOwner.pDown = NULL; 2207 pEntry->ShrdOwner.pSharedRec = pRec; 2126 2208 #if HC_ARCH_BITS == 32 2127 pEntry-> pvReserved= NULL;2209 pEntry->ShrdOwner.pvReserved = NULL; 2128 2210 #endif 2129 2211 if (pSrcPos) 2130 pEntry->S rcPos= *pSrcPos;2212 pEntry->ShrdOwner.SrcPos = *pSrcPos; 2131 2213 else 2132 rtLockValidatorSrcPosInit(&pEntry->S rcPos);2214 rtLockValidatorSrcPosInit(&pEntry->ShrdOwner.SrcPos); 2133 2215 return pEntry; 2134 2216 } … … 2337 2419 return; 2338 2420 AssertReturnVoid(hThread == NIL_RTTHREAD || hThread->u32Magic == RTTHREADINT_MAGIC); 2421 AssertReturnVoid(pRec->fSignaller); 2339 2422 2340 2423 /* … … 2374 2457 * Allocate a new owner entry and insert it into the table. 2375 2458 */ 2376 PRTLOCKVALREC SHRDOWN pEntry = rtLockValidatorRecSharedAllocOwner(pRec, hThread, pSrcPos);2459 PRTLOCKVALRECUNION pEntry = rtLockValidatorRecSharedAllocOwner(pRec, hThread, pSrcPos); 2377 2460 if ( pEntry 2378 && !rtLockValidatorRecSharedAddOwner(pRec, pEntry))2379 rtLockValidatorRecSharedFreeOwner( pEntry);2461 && !rtLockValidatorRecSharedAddOwner(pRec, &pEntry->ShrdOwner)) 2462 rtLockValidatorRecSharedFreeOwner(&pEntry->ShrdOwner); 2380 2463 } 2381 2464 } … … 2403 2486 * so it can wait til later sometime. 2404 2487 */ 2405 PRTLOCKVALREC SHRDOWN pEntry = rtLockValidatorRecSharedFindOwner(pRec, hThread, NULL);2488 PRTLOCKVALRECUNION pEntry = rtLockValidatorRecSharedFindOwner(pRec, hThread, NULL); 2406 2489 if (pEntry) 2407 2490 { 2408 Assert(hThread == RTThreadSelf()); 2409 pEntry->cRecursion++; 2491 Assert(!pRec->fSignaller); 2492 pEntry->ShrdOwner.cRecursion++; 2493 rtLockValidatorStackPushRecursion(hThread, pEntry, pSrcPos); 2410 2494 return; 2411 2495 } … … 2415 2499 */ 2416 2500 pEntry = rtLockValidatorRecSharedAllocOwner(pRec, hThread, pSrcPos); 2417 if ( pEntry 2418 && !rtLockValidatorRecSharedAddOwner(pRec, pEntry)) 2419 rtLockValidatorRecSharedFreeOwner(pEntry); 2501 if (pEntry) 2502 { 2503 if (rtLockValidatorRecSharedAddOwner(pRec, &pEntry->ShrdOwner)) 2504 { 2505 if (!pRec->fSignaller) 2506 rtLockValidatorStackPush(hThread, pEntry, pSrcPos); 2507 } 2508 else 2509 rtLockValidatorRecSharedFreeOwner(&pEntry->ShrdOwner); 2510 } 2420 2511 } 2421 2512 RT_EXPORT_SYMBOL(RTLockValidatorRecSharedAddOwner); … … 2434 2525 */ 2435 2526 uint32_t iEntry = UINT32_MAX; /* shuts up gcc */ 2436 PRTLOCKVALREC SHRDOWN pEntry = rtLockValidatorRecSharedFindOwner(pRec, hThread, &iEntry);2527 PRTLOCKVALRECUNION pEntry = rtLockValidatorRecSharedFindOwner(pRec, hThread, &iEntry); 2437 2528 AssertReturnVoid(pEntry); 2438 if (pEntry->cRecursion > 1) 2439 { 2440 Assert(hThread == RTThreadSelf()); 2441 pEntry->cRecursion--; 2529 if (pEntry->ShrdOwner.cRecursion > 1) 2530 { 2531 Assert(!pRec->fSignaller); 2532 rtLockValidatorStackPopRecursion(hThread, pEntry); 2533 pEntry->ShrdOwner.cRecursion--; 2442 2534 } 2443 2535 else 2444 rtLockValidatorRecSharedRemoveAndFreeOwner(pRec, pEntry, iEntry); 2536 { 2537 if (!pRec->fSignaller) 2538 rtLockValidatorStackPop(hThread, (PRTLOCKVALRECUNION)pEntry); 2539 rtLockValidatorRecSharedRemoveAndFreeOwner(pRec, &pEntry->ShrdOwner, iEntry); 2540 } 2445 2541 } 2446 2542 RT_EXPORT_SYMBOL(RTLockValidatorRecSharedRemoveOwner); … … 2462 2558 * Locate the entry for this thread in the table. 2463 2559 */ 2464 uint32_t 2465 PRTLOCKVALREC SHRDOWNpEntry = rtLockValidatorRecSharedFindOwner(pRec, hThreadSelf, &iEntry);2560 uint32_t iEntry = 0; 2561 PRTLOCKVALRECUNION pEntry = rtLockValidatorRecSharedFindOwner(pRec, hThreadSelf, &iEntry); 2466 2562 if (RT_UNLIKELY(!pEntry)) 2467 2563 { … … 2474 2570 * Check the release order. 2475 2571 */ 2476 if (pRec->hClass != NIL_RTLOCKVALCLASS) 2477 { 2478 /** @todo order validation */ 2572 if ( pRec->hClass != NIL_RTLOCKVALCLASS 2573 && pRec->hClass->cMsMinOrder != RT_INDEFINITE_WAIT) 2574 { 2575 int rc = rtLockValidatorCheckOrderOnRelease(pRec->hClass, pRec->uSubClass, 2576 hThreadSelf, (PRTLOCKVALRECUNION)pEntry); 2577 if (RT_FAILURE(rc)) 2578 return rc; 2479 2579 } 2480 2580 … … 2482 2582 * Release the ownership or unwind a level of recursion. 2483 2583 */ 2484 Assert(pEntry->cRecursion > 0); 2485 if (pEntry->cRecursion > 1) 2486 pEntry->cRecursion--; 2584 Assert(pEntry->ShrdOwner.cRecursion > 0); 2585 if (pEntry->ShrdOwner.cRecursion > 1) 2586 { 2587 rtLockValidatorStackPopRecursion(hThreadSelf, pEntry); 2588 pEntry->ShrdOwner.cRecursion--; 2589 } 2487 2590 else 2488 rtLockValidatorRecSharedRemoveAndFreeOwner(pRec, pEntry, iEntry); 2591 { 2592 rtLockValidatorStackPop(hThreadSelf, pEntry); 2593 rtLockValidatorRecSharedRemoveAndFreeOwner(pRec, &pEntry->ShrdOwner, iEntry); 2594 } 2489 2595 2490 2596 return VINF_SUCCESS; … … 2507 2613 * Locate the entry for this thread in the table. 2508 2614 */ 2509 uint32_t 2510 PRTLOCKVALREC SHRDOWNpEntry = rtLockValidatorRecSharedFindOwner(pRec, hThreadSelf, &iEntry);2615 uint32_t iEntry = 0; 2616 PRTLOCKVALRECUNION pEntry = rtLockValidatorRecSharedFindOwner(pRec, hThreadSelf, &iEntry); 2511 2617 if (RT_UNLIKELY(!pEntry)) 2512 2618 { -
trunk/src/VBox/Runtime/generic/critsect-generic.cpp
r25682 r25685 45 45 46 46 47 /* In strict mode we're redefining these, so undefine them now for the implementation. */ 48 #undef RTCritSectEnter 49 #undef RTCritSectTryEnter 50 #undef RTCritSectEnterMultiple 51 52 53 47 #undef RTCritSectInit 54 48 RTDECL(int) RTCritSectInit(PRTCRITSECT pCritSect) 55 49 { 56 return RTCritSectInitEx(pCritSect, 0 );50 return RTCritSectInitEx(pCritSect, 0, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTCritSect"); 57 51 } 58 52 RT_EXPORT_SYMBOL(RTCritSectInit); 59 53 60 54 61 RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags) 62 { 55 RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszName) 56 { 57 AssertReturn(fFlags <= (RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER); 58 63 59 /* 64 60 * Initialize the structure and … … 69 65 pCritSect->cLockers = -1; 70 66 pCritSect->NativeThreadOwner = NIL_RTNATIVETHREAD; 71 int rc = RTLockValidatorRecExclCreate(&pCritSect->pValidatorRec, NIL_RTLOCKVALCLASS, 0, "RTCritSect", pCritSect); 67 int rc = RTLockValidatorRecExclCreate(&pCritSect->pValidatorRec, hClass, uSubClass, pszName, 68 pCritSect, !(fFlags & RTCRITSECT_FLAGS_NO_LOCK_VAL)); 72 69 if (RT_SUCCESS(rc)) 73 70 { … … 132 129 133 130 131 #undef RTCritSectTryEnter 134 132 RTDECL(int) RTCritSectTryEnter(PRTCRITSECT pCritSect) 135 133 { … … 164 162 #ifdef RTCRITSECT_STRICT 165 163 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 166 int rc9 = RTLockValidatorRecExclCheckOrder(pCritSect->pValidatorRec, hThreadSelf, pSrcPos );164 int rc9 = RTLockValidatorRecExclCheckOrder(pCritSect->pValidatorRec, hThreadSelf, pSrcPos, RT_INDEFINITE_WAIT); 167 165 if (RT_FAILURE(rc9)) 168 166 return rc9; … … 210 208 rc9 = RTLockValidatorRecExclCheckBlocking(pCritSect->pValidatorRec, hThreadSelf, pSrcPos, 211 209 !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING), 212 RT THREADSTATE_CRITSECT, false);210 RT_INDEFINITE_WAIT, RTTHREADSTATE_CRITSECT, false); 213 211 if (RT_FAILURE(rc9)) 214 212 { … … 244 242 245 243 244 #undef RTCritSectEnter 246 245 RTDECL(int) RTCritSectEnter(PRTCRITSECT pCritSect) 247 246 { … … 386 385 387 386 387 #undef RTCritSectEnterMultiple 388 388 RTDECL(int) RTCritSectEnterMultiple(size_t cCritSects, PRTCRITSECT *papCritSects) 389 389 { -
trunk/src/VBox/Runtime/generic/semrw-generic.cpp
r25682 r25685 135 135 pThis->u32Magic = RTSEMRW_MAGIC; 136 136 #ifdef RTSEMRW_STRICT 137 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis );138 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/ );137 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, true); 138 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/, true); 139 139 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 140 140 #endif … … 241 241 if (cMillies > 0) 242 242 { 243 int rc9 = RTLockValidatorRecSharedCheckOrder(&pThis->ValidatorRead, hThreadSelf, pSrcPos );243 int rc9 = RTLockValidatorRecSharedCheckOrder(&pThis->ValidatorRead, hThreadSelf, pSrcPos, cMillies); 244 244 if (RT_FAILURE(rc9)) 245 245 return rc9; … … 325 325 #ifdef RTSEMRW_STRICT 326 326 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true, 327 RTTHREADSTATE_RW_READ, false);327 cMillies, RTTHREADSTATE_RW_READ, false); 328 328 if (RT_FAILURE(rc)) 329 329 break; … … 532 532 { 533 533 hThreadSelf = RTThreadSelfAutoAdopt(); 534 int rc9 = RTLockValidatorRecExclCheckOrder(&pThis->ValidatorWrite, hThreadSelf, pSrcPos );534 int rc9 = RTLockValidatorRecExclCheckOrder(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, cMillies); 535 535 if (RT_FAILURE(rc9)) 536 536 return rc9; … … 614 614 #ifdef RTSEMRW_STRICT 615 615 rc = RTLockValidatorRecExclCheckBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true, 616 RTTHREADSTATE_RW_WRITE, false);616 cMillies, RTTHREADSTATE_RW_WRITE, false); 617 617 if (RT_FAILURE(rc)) 618 618 break; -
trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp
r25682 r25685 134 134 pThis->fNeedReset = false; 135 135 #ifdef RTSEMRW_STRICT 136 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis );137 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/ );136 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, true); 137 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/, true); 138 138 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 139 139 #endif … … 199 199 if (cMillies > 0) 200 200 { 201 int rc9 = RTLockValidatorRecSharedCheckOrder(&pThis->ValidatorRead, hThreadSelf, pSrcPos );201 int rc9 = RTLockValidatorRecSharedCheckOrder(&pThis->ValidatorRead, hThreadSelf, pSrcPos, cMillies); 202 202 if (RT_FAILURE(rc9)) 203 203 return rc9; … … 285 285 #ifdef RTSEMRW_STRICT 286 286 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true, 287 RTTHREADSTATE_RW_READ, false);287 cMillies, RTTHREADSTATE_RW_READ, false); 288 288 if (RT_SUCCESS(rc)) 289 289 #else … … 506 506 { 507 507 hThreadSelf = RTThreadSelfAutoAdopt(); 508 int rc9 = RTLockValidatorRecExclCheckOrder(&pThis->ValidatorWrite, hThreadSelf, pSrcPos );508 int rc9 = RTLockValidatorRecExclCheckOrder(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, cMillies); 509 509 if (RT_FAILURE(rc9)) 510 510 return rc9; … … 605 605 hThreadSelf = RTThreadSelfAutoAdopt(); 606 606 rc = RTLockValidatorRecExclCheckBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true, 607 RTTHREADSTATE_RW_WRITE, false);607 cMillies, RTTHREADSTATE_RW_WRITE, false); 608 608 } 609 609 else -
trunk/src/VBox/Runtime/r3/generic/semspinmutex-r3-generic.cpp
r21540 r25685 51 51 if (!pCritSect) 52 52 return VERR_NO_MEMORY; 53 int rc = RTCritSectInit(pCritSect); 53 int rc = RTCritSectInitEx(pCritSect, RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_NO_LOCK_VAL, 54 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemSpinMutex"); 54 55 if (RT_SUCCESS(rc)) 55 {56 pCritSect->fFlags |= RTCRITSECT_FLAGS_NO_NESTING;57 56 *phSpinMtx = (RTSEMSPINMUTEX)pCritSect; 58 }59 57 else 60 58 RTMemFree(pCritSect); -
trunk/src/VBox/Runtime/r3/linux/semevent-linux.cpp
r25682 r25685 131 131 RTLockValidatorRecSharedInit(&pThis->Signallers, 132 132 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, 133 "RTSemEvent", pThis, true /*fSignaller*/ );133 "RTSemEvent", pThis, true /*fSignaller*/, true); 134 134 pThis->fEverHadSignallers = false; 135 135 #endif … … 260 260 { 261 261 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 262 RTTHREADSTATE_EVENT, true);262 cMillies, RTTHREADSTATE_EVENT, true); 263 263 if (RT_FAILURE(rc)) 264 264 break; -
trunk/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp
r25682 r25685 132 132 RTLockValidatorRecSharedInit(&pThis->Signallers, 133 133 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, 134 "RTSemEventMulti", pThis, true /*fSignaller*/ );134 "RTSemEventMulti", pThis, true /*fSignaller*/, true); 135 135 pThis->fEverHadSignallers = false; 136 136 #endif … … 295 295 { 296 296 int rc9 = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 297 RTTHREADSTATE_EVENT_MULTI, true);297 cMillie, RTTHREADSTATE_EVENT_MULTI, true); 298 298 if (RT_FAILURE(rc9)) 299 299 return rc9; -
trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp
r25682 r25685 120 120 pThis->cNesting = 0; 121 121 #ifdef RTSEMMUTEX_STRICT 122 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemMutex", pThis );122 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemMutex", pThis, true); 123 123 #endif 124 124 … … 196 196 if (cMillies) 197 197 { 198 int rc9 = RTLockValidatorRecExclCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos );198 int rc9 = RTLockValidatorRecExclCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos, cMillies); 199 199 if (RT_FAILURE(rc9)) 200 200 return rc9; … … 241 241 #ifdef RTSEMMUTEX_STRICT 242 242 int rc9 = RTLockValidatorRecExclCheckBlocking(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true, 243 RTTHREADSTATE_MUTEX, true);243 cMillies, RTTHREADSTATE_MUTEX, true); 244 244 if (RT_FAILURE(rc9)) 245 245 return rc9; -
trunk/src/VBox/Runtime/r3/posix/semevent-posix.cpp
r25682 r25685 134 134 RTLockValidatorRecSharedInit(&pThis->Signallers, 135 135 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, 136 "RTSemEvent", pThis, true /*fSignaller*/ );136 "RTSemEvent", pThis, true /*fSignaller*/, true); 137 137 pThis->fEverHadSignallers = false; 138 138 #endif … … 332 332 { 333 333 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 334 RTTHREADSTATE_EVENT, true);334 cMillies, RTTHREADSTATE_EVENT, true); 335 335 if (RT_FAILURE(rc)) 336 336 { … … 426 426 { 427 427 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 428 RTTHREADSTATE_EVENT, true);428 cMillies, RTTHREADSTATE_EVENT, true); 429 429 if (RT_FAILURE(rc)) 430 430 { -
trunk/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp
r25682 r25685 124 124 RTLockValidatorRecSharedInit(&pThis->Signallers, 125 125 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, 126 "RTSemEventMulti", pThis, true /*fSignaller*/ );126 "RTSemEventMulti", pThis, true /*fSignaller*/, true); 127 127 pThis->fEverHadSignallers = false; 128 128 #endif … … 361 361 { 362 362 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 363 RTTHREADSTATE_EVENT_MULTI, true);363 cMillies, RTTHREADSTATE_EVENT_MULTI, true); 364 364 if (RT_FAILURE(rc)) 365 365 { … … 457 457 { 458 458 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 459 RTTHREADSTATE_EVENT_MULTI, true);459 cMillies, RTTHREADSTATE_EVENT_MULTI, true); 460 460 if (RT_FAILURE(rc)) 461 461 { -
trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
r25682 r25685 102 102 pThis->u32Magic = RTSEMMUTEX_MAGIC; 103 103 #ifdef RTSEMMUTEX_STRICT 104 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemMutex", pThis );104 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemMutex", pThis, true); 105 105 #endif 106 106 … … 189 189 hThreadSelf = RTThreadSelfAutoAdopt(); 190 190 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true, 191 RTTHREADSTATE_MUTEX, true);191 cMillies, RTTHREADSTATE_MUTEX, true); 192 192 if (RT_FAILURE(rc9)) 193 193 return rc9; -
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25682 r25685 126 126 pThis->Writer = (pthread_t)-1; 127 127 #ifdef RTSEMRW_STRICT 128 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis );129 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/ );128 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, true); 129 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/, true); 130 130 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 131 131 #endif … … 225 225 hThreadSelf = RTThreadSelfAutoAdopt(); 226 226 int rc9 = RTLockValidatorRecSharedCheckOrderAndBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true, 227 RTTHREADSTATE_RW_READ, true);227 cMillies, RTTHREADSTATE_RW_READ, true); 228 228 if (RT_FAILURE(rc9)) 229 229 return rc9; … … 418 418 hThreadSelf = RTThreadSelfAutoAdopt(); 419 419 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true, 420 RTTHREADSTATE_RW_WRITE, true);420 cMillies, RTTHREADSTATE_RW_WRITE, true); 421 421 if (RT_FAILURE(rc9)) 422 422 return rc9; -
trunk/src/VBox/Runtime/r3/stream.cpp
r25510 r25685 138 138 if (!pCritSect) 139 139 return VERR_NO_MEMORY; 140 int rc = RTCritSectInit(pCritSect); 140 141 /* The native stream lock are normally not recursive. */ 142 int rc = RTCritSectInitEx(pCritSect, RTCRITSECT_FLAGS_NO_NESTING, 143 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemSpinMutex"); 141 144 if (RT_SUCCESS(rc)) 142 145 { 143 /* The native stream lock are normally not recursive .*/144 pCritSect->fFlags |= RTCRITSECT_FLAGS_NO_NESTING;145 146 146 rc = RTCritSectEnter(pCritSect); 147 147 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Runtime/r3/win/semevent-win.cpp
r25682 r25685 89 89 RTLockValidatorRecSharedInit(&pThis->Signallers, 90 90 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, 91 "RTSemEvent", pThis, true /*fSignaller*/ );91 "RTSemEvent", pThis, true /*fSignaller*/, true); 92 92 pThis->fEverHadSignallers = false; 93 93 #endif … … 213 213 return rtSemEventWaitHandleStatus(pThis, rc); 214 214 int rc9 = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 215 RTTHREADSTATE_EVENT, true);215 cMillies, RTTHREADSTATE_EVENT, true); 216 216 if (RT_FAILURE(rc9)) 217 217 return rc9; -
trunk/src/VBox/Runtime/r3/win/semeventmulti-win.cpp
r25682 r25685 92 92 RTLockValidatorRecSharedInit(&pThis->Signallers, 93 93 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, 94 "RTSemEvent", pThis, true /*fSignaller*/ );94 "RTSemEvent", pThis, true /*fSignaller*/, true); 95 95 pThis->fEverHadSignallers = false; 96 96 #endif … … 236 236 return rtSemEventWaitHandleStatus(pThis, rc); 237 237 int rc9 = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 238 RTTHREADSTATE_EVENT_MULTI, true);238 cMillies, RTTHREADSTATE_EVENT_MULTI, true); 239 239 if (RT_FAILURE(rc9)) 240 240 return rc9; -
trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp
r25682 r25685 93 93 pThis->cRecursions = 0; 94 94 #ifdef RTSEMMUTEX_STRICT 95 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemMutex", pThis );95 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemMutex", pThis, true); 96 96 #endif 97 97 *pMutexSem = pThis; … … 183 183 hThreadSelf = RTThreadSelfAutoAdopt(); 184 184 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true, 185 RTTHREADSTATE_MUTEX, true);185 cMillies, RTTHREADSTATE_MUTEX, true); 186 186 if (RT_FAILURE(rc9)) 187 187 return rc9; -
trunk/src/VBox/VMM/PDMCritSect.cpp
r25682 r25685 127 127 if (RT_SUCCESS(rc)) 128 128 { 129 rc = RTLockValidatorRecExclCreate(&pCritSect->Core.pValidatorRec, NIL_RTLOCKVALCLASS, 0, pszName, pCritSect );129 rc = RTLockValidatorRecExclCreate(&pCritSect->Core.pValidatorRec, NIL_RTLOCKVALCLASS, 0, pszName, pCritSect, true); 130 130 if (RT_SUCCESS(rc)) 131 131 { -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
r25638 r25685 129 129 # ifdef PDMCRITSECT_STRICT 130 130 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 131 int rc2 = RTLockValidatorRecExclCheckOrder(pCritSect->s.Core.pValidatorRec, hThreadSelf, pSrcPos );131 int rc2 = RTLockValidatorRecExclCheckOrder(pCritSect->s.Core.pValidatorRec, hThreadSelf, pSrcPos, RT_INDEFINITE_WAIT); 132 132 if (RT_FAILURE(rc2)) 133 133 return rc2; … … 140 140 int rc9 = RTLockValidatorRecExclCheckBlocking(pCritSect->s.Core.pValidatorRec, hThreadSelf, pSrcPos, 141 141 !(pCritSect->s.Core.fFlags & RTCRITSECT_FLAGS_NO_NESTING), 142 RT THREADSTATE_CRITSECT, true);142 RT_INDEFINITE_WAIT, RTTHREADSTATE_CRITSECT, true); 143 143 if (RT_FAILURE(rc9)) 144 144 return rc9;
Note:
See TracChangeset
for help on using the changeset viewer.