VirtualBox

Changeset 25467 in vbox


Ignore:
Timestamp:
Dec 17, 2009 3:16:55 PM (15 years ago)
Author:
vboxsync
Message:

IPRT,PDMCritSect: More lock validation.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/err.h

    r25360 r25467  
    843843/** Don't spin for the semaphore, but it is safe to try grab it. */
    844844#define VINF_SEM_BAD_CONTEXT                (367)
     845/** Wrong locking order detected. */
     846#define VERR_SEM_LV_WRONG_ORDER             (-368)
     847/** Wrong release order detected. */
     848#define VERR_SEM_LV_WRONG_RELEASE_ORDER     (-369)
     849/** Attempt to recursively enter a non-recurisve lock. */
     850#define VERR_SEM_LV_NESTED                  (-370)
     851/** Invalid parameters passed to the lock validator. */
     852#define VERR_SEM_LV_INVALID_PARAMETER       (-371)
     853/** The lock validator detected a deadlock. */
     854#define VERR_SEM_LV_DEADLOCK                (-372)
    845855/** @} */
    846856
  • trunk/include/iprt/lockvalidator.h

    r25409 r25467  
    150150 *
    151151 * @retval  VINF_SUCCESS on success.
    152  * @retval  VERR_DEADLOCK if the order is wrong, after having whined and
    153  *          asserted.
     152 * @retval  VERR_SEM_LV_WRONG_ORDER if the order is wrong.  Will have done all
     153 *          necessary whining and breakpointing before returning.
     154 * @retval  VERR_SEM_LV_INVALID_PARAMETER if the input is invalid.
    154155 *
    155156 * @param   pRec                The validator record.
     
    170171 * Change the thread state to blocking and do deadlock detection.
    171172 *
     173 * @retval  VINF_SUCCESS
     174 * @retval  VERR_SEM_LV_DEADLOCK if blocking would deadlock.  Gone thru the
     175 *          motions.
     176 * @retval  VERR_SEM_LV_NESTED if the semaphore isn't recursive and hThread is
     177 *          already the owner.  Gone thru the motions.
     178 * @retval  VERR_SEM_LV_INVALID_PARAMETER if the input is invalid.
     179 *
    172180 * @param   pRec                The validator record we're blocing on.
    173181 * @param   hThread             The current thread.  Shall not be NIL_RTTHREAD!
     
    178186 * @param   RT_SRC_POS_DECL     Where we are blocking.
    179187 */
    180 RTDECL(void) RTLockValidatorCheckBlocking(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread,
    181                                           RTTHREADSTATE enmState, bool fRecursiveOk,
    182                                           RTHCUINTPTR uId, RT_SRC_POS_DECL);
     188RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread,
     189                                         RTTHREADSTATE enmState, bool fRecursiveOk,
     190                                         RTHCUINTPTR uId, RT_SRC_POS_DECL);
    183191
    184192/**
    185193 * Check the exit order.
    186194 *
    187  * This is called by routines implementing lock acquisition.
     195 * This is called by routines implementing releasing the lock.
    188196 *
    189197 * @retval  VINF_SUCCESS on success.
    190  * @retval  VERR_DEADLOCK if the order is wrong, after having whined and
    191  *          asserted.
     198 * @retval  VERR_SEM_LV_WRONG_RELEASE_ORDER if the order is wrong.  Will have
     199 *          done all necessary whining and breakpointing before returning.
     200 * @retval  VERR_SEM_LV_INVALID_PARAMETER if the input is invalid.
     201 *
     202 * @param   pRec                The validator record.
     203 */
     204RTDECL(int)  RTLockValidatorCheckReleaseOrder(PRTLOCKVALIDATORREC pRec);
     205
     206/**
     207 * Checks and records a lock recursion.
     208 *
     209 * @retval  VINF_SUCCESS on success.
     210 * @retval  VERR_SEM_LV_NESTED if the semaphore class forbids recursion.  Gone
     211 *          thru the motions.
     212 * @retval  VERR_SEM_LV_INVALID_PARAMETER if the input is invalid.
     213 *
     214 * @param   pRec                The validator record.
     215 * @param   uId                 Some kind of locking location ID.  Typically a
     216 *                              return address up the stack.  Optional (0).
     217 * @param   pszFile             The file where the lock is being acquired from.
     218 *                              Optional.
     219 * @param   iLine               The line number in that file.  Optional (0).
     220 * @param   pszFunction         The functionn where the lock is being acquired
     221 *                              from.  Optional.
     222 */
     223RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALIDATORREC pRec, RTHCUINTPTR uId, RT_SRC_POS_DECL);
     224
     225/**
     226 * Records a lock unwind (releasing one recursion).
     227 *
     228 * This should be coupled with called to RTLockValidatorRecordRecursion.
     229 *
     230 * @param   pRec                The validator record.
     231 */
     232RTDECL(void) RTLockValidatorRecordUnwind(PRTLOCKVALIDATORREC pRec);
     233
     234/**
     235 * Record the specified thread as lock owner and increment the write lock count.
     236 *
     237 * This function is typically called after acquiring the lock.
     238 *
     239 * @returns hThread resolved.  Can return NIL_RTHREAD iff we fail to adopt the
     240 *          alien thread or if pRec is invalid.
    192241 *
    193242 * @param   pRec                The validator record.
     
    203252 *                              from.  Optional.
    204253 */
    205 RTDECL(int)  RTLockValidatorCheckReleaseOrder(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread);
    206 
    207 
    208 /**
    209  * Record the specified thread as lock owner.
    210  *
    211  * This is typically called after acquiring the lock.
    212  *
    213  * @returns hThread resolved.  Can return NIL_RTHREAD iff we fail to adopt the
    214  *          alien thread or if pRec is invalid.
    215  *
    216  * @param   pRec                The validator record.
    217  * @param   hThread             The handle of the calling thread.  If not known,
    218  *                              pass NIL_RTTHREAD and this method will figure it
    219  *                              out.
    220  * @param   uId                 Some kind of locking location ID.  Typically a
    221  *                              return address up the stack.  Optional (0).
    222  * @param   pszFile             The file where the lock is being acquired from.
    223  *                              Optional.
    224  * @param   iLine               The line number in that file.  Optional (0).
    225  * @param   pszFunction         The functionn where the lock is being acquired
    226  *                              from.  Optional.
    227  */
    228254RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    229255
    230256
    231257/**
    232  * Clear the lock ownership.
     258 * Clear the lock ownership and decrement the write lock count.
    233259 *
    234260 * This is typically called before release the lock.
  • trunk/include/iprt/semaphore.h

    r25426 r25467  
    247247 * @param   MutexSem            The mutex semaphore to request ownership over.
    248248 * @param   cMillies            The number of milliseconds to wait.
    249  * @param   uId
    250249 * @param   uId                 Some kind of locking location ID.  Typically a
    251250 *                              return address up the stack.  Optional (0).
     
    262261 *
    263262 * @returns iprt status code.
    264  *          Will not return VERR_INTERRUPTED.
    265263 * @param   MutexSem            The mutex semaphore to request ownership over.
    266264 * @param   cMillies            The number of milliseconds to wait.
    267  * @param   uId
    268265 * @param   uId                 Some kind of locking location ID.  Typically a
    269266 *                              return address up the stack.  Optional (0).
     
    530527 */
    531528RTDECL(int)   RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies);
     529
     530/**
     531 * Debug version of RTSemRWRequestWrite that tracks the location.
     532 *
     533 * @returns IPRT status code, see RTSemRWRequestWrite.
     534 * @param   RWSem               The Read/Write semaphore to request write access
     535 *                              to.
     536 * @param   cMillies            The number of milliseconds to wait.
     537 * @param   uId                 Some kind of locking location ID.  Typically a
     538 *                              return address up the stack.  Optional (0).
     539 * @param   pszFile             The file where the lock is being acquired from.
     540 *                              Optional.
     541 * @param   iLine               The line number in that file.  Optional (0).
     542 * @param   pszFunction         The functionn where the lock is being acquired
     543 *                              from.  Optional.
     544 */
     545RTDECL(int)  RTSemRWRequestWriteDebug(RTSEMRW MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
     546
     547/**
     548 * Debug version of RTSemRWRequestWriteNoResume that tracks the location.
     549 *
     550 * @returns IPRT status code, see RTSemRWRequestWriteNoResume.
     551 * @param   RWSem               The Read/Write semaphore to request write access
     552 *                              to.
     553 * @param   cMillies            The number of milliseconds to wait.
     554 * @param   uId                 Some kind of locking location ID.  Typically a
     555 *                              return address up the stack.  Optional (0).
     556 * @param   pszFile             The file where the lock is being acquired from.
     557 *                              Optional.
     558 * @param   iLine               The line number in that file.  Optional (0).
     559 * @param   pszFunction         The functionn where the lock is being acquired
     560 *                              from.  Optional.
     561 */
     562RTDECL(int)  RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    532563
    533564/**
  • trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp

    r25436 r25467  
    181181RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    182182{
    183     AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, VERR_INVALID_MAGIC);
     183    AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);
    184184
    185185    /*
     
    196196
    197197
     198RTDECL(int)  RTLockValidatorCheckReleaseOrder(PRTLOCKVALIDATORREC pRec)
     199{
     200    AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);
     201    AssertReturn(pRec->hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER);
     202
     203    return VINF_SUCCESS;
     204}
     205
     206
     207RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALIDATORREC pRec, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     208{
     209    AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);
     210    AssertReturn(pRec->hThread != NIL_RTTHREAD, VERR_SEM_LV_INVALID_PARAMETER);
     211
     212    Assert(pRec->cRecursion < _1M);
     213    pRec->cRecursion++;
     214
     215    return VINF_SUCCESS;
     216}
     217
     218
     219RTDECL(void) RTLockValidatorRecordUnwind(PRTLOCKVALIDATORREC pRec)
     220{
     221    AssertReturnVoid(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC);
     222    AssertReturnVoid(pRec->hThread != NIL_RTTHREAD);
     223    AssertReturnVoid(pRec->cRecursion > 0);
     224
     225    pRec->cRecursion--;
     226}
     227
     228
    198229RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    199230{
     
    201232
    202233    if (hThread == NIL_RTTHREAD)
     234    {
    203235        hThread = RTThreadSelfAutoAdopt();
     236        AssertReturn(hThread != NIL_RTTHREAD, hThread);
     237    }
     238
     239    ASMAtomicIncS32(&hThread->LockValidator.cWriteLocks);
     240
    204241    if (pRec->hThread == hThread)
    205242        pRec->cRecursion++;
     
    232269{
    233270    AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, NIL_RTTHREAD);
    234     RTTHREAD hThread = pRec->hThread;
    235     AssertReturn(hThread != NIL_RTTHREAD, hThread);
    236     AssertReturn(pRec->hThread == hThread, hThread);
     271    RTTHREADINT *pThread = pRec->hThread;
     272    AssertReturn(pThread != NIL_RTTHREAD, pThread);
     273
     274    ASMAtomicDecS32(&pThread->LockValidator.cWriteLocks);
    237275
    238276    if (ASMAtomicDecU32(&pRec->cRecursion) == 0)
     
    249287    }
    250288
    251     return hThread;
     289    return pThread;
    252290}
    253291
     
    421459
    422460
    423 /**
    424  * Change the thread state to blocking and do deadlock detection.
    425  *
    426  * @param   pRec                The validator record we're blocing on.
    427  * @param   hThread             The current thread.  Shall not be NIL_RTTHREAD!
    428  * @param   enmState            The sleep state.
    429  * @param   pvBlock             Pointer to a RTLOCKVALIDATORREC structure.
    430  * @param   fRecursiveOk        Whether it's ok to recurse.
    431  * @param   uId                 Where we are blocking.
    432  * @param   RT_SRC_POS_DECL     Where we are blocking.
    433  */
    434 RTDECL(void) RTLockValidatorCheckBlocking(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread,
    435                                           RTTHREADSTATE enmState, bool fRecursiveOk,
    436                                           RTHCUINTPTR uId, RT_SRC_POS_DECL)
     461RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread,
     462                                         RTTHREADSTATE enmState, bool fRecursiveOk,
     463                                         RTHCUINTPTR uId, RT_SRC_POS_DECL)
    437464{
    438465    /*
    439466     * Fend off wild life.
    440467     */
    441     AssertReturnVoid(RTTHREAD_IS_SLEEPING(enmState));
    442     AssertPtrReturnVoid(pRec);
    443     AssertReturnVoid(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC);
     468    AssertReturn(RTTHREAD_IS_SLEEPING(enmState), VERR_SEM_LV_INVALID_PARAMETER);
     469    AssertPtrReturn(pRec, VERR_SEM_LV_INVALID_PARAMETER);
     470    AssertReturn(pRec->u32Magic == RTLOCKVALIDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);
    444471    PRTTHREADINT pThread = hThread;
    445     AssertPtrReturnVoid(pThread);
    446     AssertReturnVoid(pThread->u32Magic == RTTHREADINT_MAGIC);
     472    AssertPtrReturn(pThread, VERR_SEM_LV_INVALID_PARAMETER);
     473    AssertReturn(pThread->u32Magic == RTTHREADINT_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);
    447474    RTTHREADSTATE enmThreadState = rtThreadGetState(pThread);
    448     AssertReturnVoid(   enmThreadState == RTTHREADSTATE_RUNNING
    449                      || enmThreadState == RTTHREADSTATE_TERMINATED /* rtThreadRemove uses locks too */);
     475    AssertReturn(   enmThreadState == RTTHREADSTATE_RUNNING
     476                 || enmThreadState == RTTHREADSTATE_TERMINATED   /* rtThreadRemove uses locks too */
     477                 || enmThreadState == RTTHREADSTATE_INITIALIZING /* rtThreadInsert uses locks too */
     478                 , VERR_SEM_LV_INVALID_PARAMETER);
    450479
    451480    /*
     
    468497     * isn't any other place to check for this.  semmutex-win.cpp for instance.
    469498     */
    470     if (    !fRecursiveOk
    471         ||  pRec->hThread != pThread)
    472     {
    473         /*
    474          * Do deadlock detection.
    475          *
    476          * Since we're missing proper serialization, we don't declare it a
    477          * deadlock until we've got three runs with the same list length.
    478          * While this isn't perfect, it should avoid out the most obvious
    479          * races on SMP boxes.
    480          */
    481         rtLockValidatorSerializeDetectionEnter();
    482 
    483         PRTTHREADINT    pCur;
    484         unsigned        cPrevLength = ~0U;
    485         unsigned        cEqualRuns  = 0;
    486         unsigned        iParanoia   = 256;
    487         do
     499    if (pRec->hThread == pThread)
     500    {
     501        if (fRecursiveOk)
     502            return VINF_SUCCESS;
     503        AssertMsgFailed(("%p (%s)\n", pRec->hLock, pRec->pszName));
     504        return VERR_SEM_LV_NESTED;
     505    }
     506
     507    /*
     508     * Do deadlock detection.
     509     *
     510     * Since we're missing proper serialization, we don't declare it a
     511     * deadlock until we've got three runs with the same list length.
     512     * While this isn't perfect, it should avoid out the most obvious
     513     * races on SMP boxes.
     514     */
     515    rtLockValidatorSerializeDetectionEnter();
     516
     517    PRTTHREADINT    pCur;
     518    unsigned        cPrevLength = ~0U;
     519    unsigned        cEqualRuns  = 0;
     520    unsigned        iParanoia   = 256;
     521    do
     522    {
     523        unsigned cLength = 0;
     524        pCur = pThread;
     525        for (;;)
    488526        {
    489             unsigned cLength = 0;
    490             pCur = pThread;
     527            /*
     528             * Get the next thread.
     529             */
     530            PRTTHREADINT pNext = NULL;
    491531            for (;;)
    492532            {
    493                 /*
    494                  * Get the next thread.
    495                  */
    496                 PRTTHREADINT pNext = NULL;
    497                 for (;;)
     533                RTTHREADSTATE enmCurState = rtThreadGetState(pCur);
     534                switch (enmCurState)
    498535                {
    499                     RTTHREADSTATE enmCurState = rtThreadGetState(pCur);
    500                     switch (enmCurState)
     536                    case RTTHREADSTATE_CRITSECT:
     537                    case RTTHREADSTATE_EVENT:
     538                    case RTTHREADSTATE_EVENT_MULTI:
     539                    case RTTHREADSTATE_FAST_MUTEX:
     540                    case RTTHREADSTATE_MUTEX:
     541                    case RTTHREADSTATE_RW_READ:
     542                    case RTTHREADSTATE_RW_WRITE:
     543                    case RTTHREADSTATE_SPIN_MUTEX:
    501544                    {
    502                         case RTTHREADSTATE_CRITSECT:
    503                         case RTTHREADSTATE_EVENT:
    504                         case RTTHREADSTATE_EVENT_MULTI:
    505                         case RTTHREADSTATE_FAST_MUTEX:
    506                         case RTTHREADSTATE_MUTEX:
    507                         case RTTHREADSTATE_RW_READ:
    508                         case RTTHREADSTATE_RW_WRITE:
    509                         case RTTHREADSTATE_SPIN_MUTEX:
    510                         {
    511                             PRTLOCKVALIDATORREC pCurRec = pCur->LockValidator.pRec;
    512                             if (    rtThreadGetState(pCur) != enmCurState
    513                                 ||  !VALID_PTR(pCurRec)
    514                                 ||  pCurRec->u32Magic != RTLOCKVALIDATORREC_MAGIC)
    515                                 continue;
    516                             pNext = pCurRec->hThread;
    517                             if (    rtThreadGetState(pCur) != enmCurState
    518                                 ||  pCurRec->u32Magic != RTLOCKVALIDATORREC_MAGIC
    519                                 ||  pCurRec->hThread != pNext)
    520                                 continue;
    521                             break;
    522                         }
    523 
    524                         default:
    525                             pNext = NULL;
    526                             break;
     545                        PRTLOCKVALIDATORREC pCurRec = pCur->LockValidator.pRec;
     546                        if (    rtThreadGetState(pCur) != enmCurState
     547                            ||  !VALID_PTR(pCurRec)
     548                            ||  pCurRec->u32Magic != RTLOCKVALIDATORREC_MAGIC)
     549                            continue;
     550                        pNext = pCurRec->hThread;
     551                        if (    rtThreadGetState(pCur) != enmCurState
     552                            ||  pCurRec->u32Magic != RTLOCKVALIDATORREC_MAGIC
     553                            ||  pCurRec->hThread != pNext)
     554                            continue;
     555                        break;
    527556                    }
    528                     break;
     557
     558                    default:
     559                        pNext = NULL;
     560                        break;
    529561                }
    530 
    531                 /*
    532                  * If we arrive at the end of the list we're good.
    533                  */
    534                 pCur = pNext;
    535                 if (!pCur)
    536                 {
    537                     rtLockValidatorSerializeDetectionLeave();
    538                     return;
    539                 }
    540 
    541                 /*
    542                  * If we've got back to the blocking thread id we've
    543                  * got a deadlock.
    544                  */
    545                 if (pCur == pThread)
    546                     break;
    547 
    548                 /*
    549                  * If we've got a chain of more than 256 items, there is some
    550                  * kind of cycle in the list, which means that there is already
    551                  * a deadlock somewhere.
    552                  */
    553                 if (cLength >= 256)
    554                     break;
    555 
    556                 cLength++;
     562                break;
    557563            }
    558564
    559             /* compare with previous list run. */
    560             if (cLength != cPrevLength)
     565            /*
     566             * If we arrive at the end of the list we're good.
     567             */
     568            pCur = pNext;
     569            if (!pCur)
    561570            {
    562                 cPrevLength = cLength;
    563                 cEqualRuns = 0;
     571                rtLockValidatorSerializeDetectionLeave();
     572                return VINF_SUCCESS;
    564573            }
    565             else
    566                 cEqualRuns++;
    567         } while (cEqualRuns < 3 && --iParanoia > 0);
    568 
    569         /*
    570          * Ok, if we ever get here, it's most likely a genuine deadlock.
    571          */
    572         rtLockValidatorComplainAboutDeadlock(pRec, pThread, enmState, pCur, uId, RT_SRC_POS_ARGS);
    573 
    574         rtLockValidatorSerializeDetectionLeave();
    575     }
     574
     575            /*
     576             * If we've got back to the blocking thread id we've
     577             * got a deadlock.
     578             */
     579            if (pCur == pThread)
     580                break;
     581
     582            /*
     583             * If we've got a chain of more than 256 items, there is some
     584             * kind of cycle in the list, which means that there is already
     585             * a deadlock somewhere.
     586             */
     587            if (cLength >= 256)
     588                break;
     589
     590            cLength++;
     591        }
     592
     593        /* compare with previous list run. */
     594        if (cLength != cPrevLength)
     595        {
     596            cPrevLength = cLength;
     597            cEqualRuns = 0;
     598        }
     599        else
     600            cEqualRuns++;
     601    } while (cEqualRuns < 3 && --iParanoia > 0);
     602
     603    /*
     604     * Ok, if we ever get here, it's most likely a genuine deadlock.
     605     */
     606    rtLockValidatorComplainAboutDeadlock(pRec, pThread, enmState, pCur, uId, RT_SRC_POS_ARGS);
     607
     608    rtLockValidatorSerializeDetectionLeave();
     609
     610    return VERR_SEM_LV_DEADLOCK;
    576611}
    577612RT_EXPORT_SYMBOL(RTThreadBlocking);
  • trunk/src/VBox/Runtime/generic/critsect-generic.cpp

    r25409 r25467  
    244244    ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf);
    245245#ifdef RTCRITSECT_STRICT
    246     RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS));
     246    RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS);
    247247#endif
    248248
     
    321321        for (;;)
    322322        {
    323             RTCRITSECT_STRICT_BLOCK(hThreadSelf, pCritSect->pValidatorRec, !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING));
     323#ifdef RTCRITSECT_STRICT
     324            int rc9 = RTLockValidatorCheckBlocking(pCritSect->pValidatorRec, hThreadSelf, RTTHREADSTATE_CRITSECT,
     325                                                   !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING),
     326                                                   uId, RT_SRC_POS_ARGS);
     327            if (RT_FAILURE(rc9))
     328            {
     329                ASMAtomicDecS32(&pCritSect->cLockers);
     330                return rc9;
     331            }
     332#else
     333            RTThreadBlocking(hThreadSelf, RTTHREADSTATE_CRITSECT);
     334#endif
     335
    324336            int rc = RTSemEventWait(pCritSect->EventSem, RT_INDEFINITE_WAIT);
    325             RTCRITSECT_STRICT_UNBLOCK(hThreadSelf);
     337
     338            RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_CRITSECT);
    326339            if (pCritSect->u32Magic != RTCRITSECT_MAGIC)
    327340                return VERR_SEM_DESTROYED;
     
    339352    ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf);
    340353#ifdef RTCRITSECT_STRICT
    341     RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS));
     354    RTLockValidatorSetOwner(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS);
    342355#endif
    343356
     
    392405         */
    393406#ifdef RTCRITSECT_STRICT
    394         RTLockValidatorWriteLockInc(RTLockValidatorUnsetOwner(pCritSect->pValidatorRec));
     407        RTLockValidatorUnsetOwner(pCritSect->pValidatorRec);
    395408#endif
    396409        ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NIL_RTNATIVETHREAD);
  • trunk/src/VBox/Runtime/include/internal/strict.h

    r25406 r25467  
    4545# define RTCRITSECT_STRICT_POS_DECL             RTHCUINTPTR uId, RT_SRC_POS_DECL
    4646# define RTCRITSECT_STRICT_POS_ARGS             uId, RT_SRC_POS_ARGS
    47 # define RTCRITSECT_STRICT_BLOCK(hThread, pRec, fRecursive) \
    48                                                 RTLockValidatorCheckBlocking(pRec, (hThread), RTTHREADSTATE_CRITSECT, fRecursive, uId, RT_SRC_POS_ARGS)
    4947#else
    5048# define RTCRITSECT_STRICT_POS_DECL             int iDummy
    5149# define RTCRITSECT_STRICT_POS_ARGS             0
    52 # define RTCRITSECT_STRICT_BLOCK(hThread, pRec, fRecursive) \
    53                                                 RTThreadBlocking((hThread), RTTHREADSTATE_CRITSECT)
    5450#endif
    55 #define  RTCRITSECT_STRICT_UNBLOCK(hThread)     RTThreadUnblocked((hThread), RTTHREADSTATE_CRITSECT)
    5651
    5752
     
    6661# define RTSEMMUTEX_STRICT_POS_DECL             RTHCUINTPTR uId, RT_SRC_POS_DECL
    6762# define RTSEMMUTEX_STRICT_POS_ARGS             uId, RT_SRC_POS_ARGS
    68 # define RTSEMMUTEX_STRICT_BLOCK(hThread, pRec) RTLockValidatorCheckBlocking(pRec, (hThread), RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS)
    6963#else
    7064# define RTSEMMUTEX_STRICT_POS_DECL             int iDummy
    7165# define RTSEMMUTEX_STRICT_POS_ARGS             0
    72 # define RTSEMMUTEX_STRICT_BLOCK(hThread, pRec) RTThreadBlocking((hThread), RTTHREADSTATE_MUTEX)
    7366#endif
    74 #define  RTSEMMUTEX_STRICT_UNBLOCK(hThread)     RTThreadUnblocked((hThread), RTTHREADSTATE_MUTEX)
    7567
    7668
     
    8375
    8476#ifdef RTSEMRW_STRICT
    85 # define RTSEMRW_STRICT_POS_DECL            RTHCUINTPTR uId, RT_SRC_POS_DECL
    86 # define RTSEMRW_STRICT_POS_ARGS            uId, RT_SRC_POS_ARGS
    87 # define RTSEMRW_STRICT_BLOCK_ARGS(pRec)    pRec, uId, RT_SRC_POS_ARGS
     77# define RTSEMRW_STRICT_POS_DECL                RTHCUINTPTR uId, RT_SRC_POS_DECL
     78# define RTSEMRW_STRICT_POS_ARGS                uId, RT_SRC_POS_ARGS
    8879#else
    89 # define RTSEMRW_STRICT_POS_DECL            int iDummy
    90 # define RTSEMRW_STRICT_POS_ARGS            0
    91 # define RTSEMRW_STRICT_BLOCK_ARGS(pRec)    NULL, 0, NULL, 0, NULL
     80# define RTSEMRW_STRICT_POS_DECL                int iDummy
     81# define RTSEMRW_STRICT_POS_ARGS                0
    9282#endif
    9383
  • trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp

    r25409 r25467  
    229229             */
    230230            if (pTimeout && ( pTimeout->tv_sec || pTimeout->tv_nsec ))
    231                 RTSEMMUTEX_STRICT_BLOCK(hThreadSelf, &pThis->ValidatorRec);
     231            {
     232#ifdef RTSEMMUTEX_STRICT
     233                int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf,
     234                                                       RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS);
     235                if (RT_FAILURE(rc9))
     236                    return rc9;
     237#else
     238                RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX);
     239#endif
     240            }
     241
    232242            long rc = sys_futex(&pThis->iState, FUTEX_WAIT, 2, pTimeout, NULL, 0);
    233             RTSEMMUTEX_STRICT_UNBLOCK(hThreadSelf);
     243
     244            RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_MUTEX);
    234245            if (RT_UNLIKELY(pThis->u32Magic != RTSEMMUTEX_MAGIC))
    235246                return VERR_SEM_DESTROYED;
     
    289300    ASMAtomicWriteU32(&pThis->cNesting, 1);
    290301#ifdef RTSEMMUTEX_STRICT
    291     RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS));
     302    RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);
    292303#endif
    293304    return VINF_SUCCESS;
     
    373384     */
    374385#ifdef RTSEMMUTEX_STRICT
    375     RTLockValidatorWriteLockDec(RTLockValidatorUnsetOwner(&pThis->ValidatorRec));
     386    RTLockValidatorUnsetOwner(&pThis->ValidatorRec);
    376387#endif
    377388    pThis->Owner = (pthread_t)~0;
  • trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp

    r25409 r25467  
    186186     * Lock it.
    187187     */
     188    if (cMillies != 0)
     189    {
     190#ifdef RTSEMMUTEX_STRICT
     191        int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf,
     192                                               RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS);
     193        if (RT_FAILURE(rc9))
     194            return rc9;
     195#else
     196        RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX);
     197#endif
     198    }
     199
    188200    if (cMillies == RT_INDEFINITE_WAIT)
    189201    {
    190202        /* take mutex */
    191         RTSEMMUTEX_STRICT_BLOCK(hThreadSelf, &pThis->ValidatorRec);
    192203        int rc = pthread_mutex_lock(&pThis->Mutex);
    193         RTSEMMUTEX_STRICT_UNBLOCK(hThreadSelf);
     204        RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_MUTEX);
    194205        if (rc)
    195206        {
     
    218229                ts.tv_sec++;
    219230            }
    220             RTSEMMUTEX_STRICT_BLOCK(hThreadSelf, &pThis->ValidatorRec);
    221231        }
    222232
    223233        /* take mutex */
    224234        int rc = pthread_mutex_timedlock(&pThis->Mutex, &ts);
    225         RTSEMMUTEX_STRICT_UNBLOCK(hThreadSelf);
     235        RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_MUTEX);
    226236        if (rc)
    227237        {
     
    238248    ASMAtomicWriteU32(&pThis->cNesting, 1);
    239249#ifdef RTSEMMUTEX_STRICT
    240     RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS));
     250    RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);
    241251#endif
    242252
     
    321331     */
    322332#ifdef RTSEMMUTEX_STRICT
    323     RTLockValidatorWriteLockDec(RTLockValidatorUnsetOwner(&pThis->ValidatorRec));
     333    RTLockValidatorUnsetOwner(&pThis->ValidatorRec);
    324334#endif
    325335    pThis->Owner = (pthread_t)-1;
  • trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp

    r25409 r25467  
    8383    /** pthread rwlock. */
    8484    pthread_rwlock_t    RWLock;
     85#ifdef RTSEMRW_STRICT
     86    /** The validator record for the writer. */
     87    RTLOCKVALIDATORREC  ValidatorRec;
     88#endif
    8589};
    8690
     
    111115                pThis->cWriterReads = 0;
    112116                pThis->Writer = (pthread_t)-1;
     117#ifdef RTSEMRW_STRICT
     118                RTLockValidatorInit(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, NULL, pThis);
     119#endif
    113120                *pRWSem = pThis;
    114121                return VINF_SUCCESS;
     
    131138     * Validate input, nil handle is fine.
    132139     */
    133     if (RWSem == NIL_RTSEMRW)
     140    struct RTSEMRWINTERNAL *pThis = RWSem;
     141    if (pThis == NIL_RTSEMRW)
    134142        return VINF_SUCCESS;
    135     struct RTSEMRWINTERNAL *pThis = RWSem;
    136143    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    137144    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    145152     * Try destroy it.
    146153     */
     154    AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, ~RTSEMRW_MAGIC, RTSEMRW_MAGIC), VERR_INVALID_HANDLE);
    147155    int rc = pthread_rwlock_destroy(&pThis->RWLock);
    148156    if (!rc)
    149157    {
    150         pThis->u32Magic++;
     158#ifdef RTSEMRW_STRICT
     159        RTLockValidatorInit(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, NULL, pThis);
     160#endif
    151161        RTMemFree(pThis);
    152162        rc = VINF_SUCCESS;
     
    154164    else
    155165    {
     166        ASMAtomicWriteU32(&pThis->u32Magic, RTSEMRW_MAGIC);
    156167        AssertMsgFailed(("Failed to destroy read-write sem %p, rc=%d.\n", RWSem, rc));
    157168        rc = RTErrConvertFromErrno(rc);
     
    304315
    305316
    306 RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies)
     317DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, RTSEMRW_STRICT_POS_DECL)
    307318{
    308319    /*
     
    314325                    ("pThis=%p u32Magic=%#x\n", pThis, pThis->u32Magic),
    315326                    VERR_INVALID_HANDLE);
     327#ifdef RTSEMRW_STRICT
     328    RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt();
     329    RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, RTSEMRW_STRICT_POS_ARGS);
     330#endif
    316331
    317332    /*
     
    323338    if (Writer == Self)
    324339    {
     340#ifdef RTSEMRW_STRICT
     341        int rc9 = RTLockValidatorRecordRecursion(&pThis->ValidatorRec, RTSEMRW_STRICT_POS_ARGS);
     342        if (RT_FAILURE(rc9))
     343            return rc9;
     344#endif
    325345        Assert(pThis->cWrites < INT32_MAX);
    326346        pThis->cWrites++;
    327347        return VINF_SUCCESS;
    328348    }
     349#ifndef RTSEMRW_STRICT
     350    RTTHREAD hThreadSelf = RTThreadSelf();
     351#endif
    329352
    330353    /*
    331354     * Try lock it.
    332355     */
     356    if (cMillies)
     357    {
     358#ifdef RTSEMRW_STRICT
     359        int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf, RTTHREADSTATE_RW_WRITE, true, uId, RT_SRC_POS_ARGS);
     360        if (RT_FAILURE(rc9))
     361            return rc9;
     362#else
     363        RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE);
     364#endif
     365    }
     366
    333367    if (cMillies == RT_INDEFINITE_WAIT)
    334368    {
    335369        /* take rwlock */
    336370        int rc = pthread_rwlock_wrlock(&pThis->RWLock);
     371        RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_RW_WRITE);
    337372        if (rc)
    338373        {
     
    365400        /* take rwlock */
    366401        int rc = pthread_rwlock_timedwrlock(&pThis->RWLock, &ts);
     402        RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_RW_WRITE);
    367403        if (rc)
    368404        {
     
    376412    pThis->cWrites = 1;
    377413#ifdef RTSEMRW_STRICT
    378     RTTHREAD ThreadSelf = RTThreadSelf();
    379     if (ThreadSelf != NIL_RTTHREAD)
    380         RTLockValidatorWriteLockInc(ThreadSelf);
     414    RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMRW_STRICT_POS_ARGS);
    381415#endif
    382416    return VINF_SUCCESS;
     
    384418
    385419
     420RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies)
     421{
     422#ifndef RTSEMRW_STRICT
     423    return rtSemRWRequestWrite(RWSem, cMillies, RTSEMRW_STRICT_POS_ARGS);
     424#else
     425    return RTSemRWRequestWriteDebug(RWSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS);
     426#endif
     427}
     428
     429
     430RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     431{
     432#ifdef RTSEMRW_STRICT
     433    return rtSemRWRequestWrite(RWSem, cMillies, RTSEMRW_STRICT_POS_ARGS);
     434#else
     435    return RTSemRWRequestWrite(RWSem, cMillies);
     436#endif
     437}
     438
     439
    386440RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies)
    387441{
    388442    /* EINTR isn't returned by the wait functions we're using. */
     443#ifndef RTSEMRW_STRICT
    389444    return RTSemRWRequestWrite(RWSem, cMillies);
     445#else
     446    return RTSemRWRequestWriteDebug(RWSem, cMillies, (uintptr_t)ASMReturnAddress(), RT_SRC_POS);
     447#endif
     448}
     449
     450
     451RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     452{
     453    /* 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
    390459}
    391460
     
    409478    ATOMIC_GET_PTHREAD_T(&pThis->Writer, &Writer);
    410479    AssertMsgReturn(Writer == Self, ("pThis=%p\n", pThis), VERR_NOT_OWNER);
     480    AssertReturn(pThis->cWriterReads == 0 || pThis->cWrites > 1, VERR_WRONG_ORDER);
     481
    411482    pThis->cWrites--;
    412483    if (pThis->cWrites)
     484    {
     485#ifdef RTSEMRW_STRICT
     486        RTLockValidatorRecordUnwind(&pThis->ValidatorRec);
     487#endif
    413488        return VINF_SUCCESS;
    414     AssertReturn(!pThis->cWriterReads, VERR_WRONG_ORDER);
     489    }
    415490
    416491    /*
    417492     * Try unlock it.
    418493     */
     494#ifdef RTSEMRW_STRICT
     495    RTLockValidatorCheckReleaseOrder(&pThis->ValidatorRec);
     496    RTLockValidatorUnsetOwner(&pThis->ValidatorRec);
     497#endif
     498
    419499    ATOMIC_SET_PTHREAD_T(&pThis->Writer, (pthread_t)-1);
    420500    int rc = pthread_rwlock_unlock(&pThis->RWLock);
     
    425505    }
    426506
    427 #ifdef RTSEMRW_STRICT
    428     RTTHREAD ThreadSelf = RTThreadSelf();
    429     if (ThreadSelf != NIL_RTTHREAD)
    430         RTLockValidatorWriteLockDec(ThreadSelf);
    431 #endif
    432507    return VINF_SUCCESS;
    433508}
  • trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp

    r25409 r25467  
    162162     */
    163163    if (cMillies > 0)
    164         RTSEMMUTEX_STRICT_BLOCK(hThreadSelf, &pThis->ValidatorRec);
     164    {
     165#ifdef RTSEMMUTEX_STRICT
     166        int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf,
     167                                               RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS);
     168        if (RT_FAILURE(rc9))
     169            return rc9;
     170#else
     171        RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX);
     172#endif
     173    }
    165174    int rc = WaitForSingleObjectEx(pThis->hMtx,
    166175                                   cMillies == RT_INDEFINITE_WAIT ? INFINITE : cMillies,
    167176                                   TRUE /*bAlertable*/);
    168     RTSEMMUTEX_STRICT_UNBLOCK(hThreadSelf);
     177    RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_MUTEX);
    169178    switch (rc)
    170179    {
    171180        case WAIT_OBJECT_0:
    172181#ifdef RTSEMMUTEX_STRICT
    173             RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS));
     182            RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, RTSEMMUTEX_STRICT_POS_ARGS);
    174183#endif
    175184            return VINF_SUCCESS;
     
    227236    if (   pThis->ValidatorRec.hThread != NIL_RTTHREAD
    228237        && pThis->ValidatorRec.hThread == RTThreadSelf())
    229         RTLockValidatorWriteLockDec(RTLockValidatorUnsetOwner(&pThis->ValidatorRec));
     238        RTLockValidatorUnsetOwner(&pThis->ValidatorRec);
    230239    else
    231240        AssertMsgFailed(("%p hThread=%RTthrd\n", pThis, pThis->ValidatorRec.hThread));
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r25409 r25467  
    5555# define PDMCRITSECT_STRICT_POS_DECL            RTHCUINTPTR uId, RT_SRC_POS_DECL
    5656# define PDMCRITSECT_STRICT_POS_ARGS            uId, RT_SRC_POS_ARGS
    57 # define PDMCRITSECT_STRICT_BLOCK(hThread, pRec, fRecursive) \
    58                                                 RTLockValidatorCheckBlocking(pRec, (hThread), RTTHREADSTATE_CRITSECT, fRecursive, uId, RT_SRC_POS_ARGS)
     57# define PDMCRITSECT_STRICT_BLOCK_RET(hThread, pRec, fRecursive) \
     58    do { \
     59        int rc9 = RTLockValidatorCheckBlocking(pRec, (hThread), RTTHREADSTATE_CRITSECT, fRecursive, uId, RT_SRC_POS_ARGS); \
     60        if (RT_FAILURE(rc9)) \
     61            return rc9; \
     62    } while (0)
    5963#else
    6064# define PDMCRITSECT_STRICT_POS_DECL            int iDummy
    6165# define PDMCRITSECT_STRICT_POS_ARGS            0
    62 # define PDMCRITSECT_STRICT_BLOCK(hThread, pRec, fRecursive) \
     66# define PDMCRITSECT_STRICT_BLOCK_RET(hThread, pRec, fRecursive) \
    6367                                                RTThreadBlocking((hThread), RTTHREADSTATE_CRITSECT)
    6468#endif
     
    109113
    110114# ifdef PDMCRITSECT_STRICT
    111     RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(pCritSect->s.Core.pValidatorRec, NIL_RTTHREAD, PDMCRITSECT_STRICT_POS_ARGS));
     115    RTLockValidatorSetOwner(pCritSect->s.Core.pValidatorRec, NIL_RTTHREAD, PDMCRITSECT_STRICT_POS_ARGS);
    112116# endif
    113117
     
    141145# ifdef PDMCRITSECT_STRICT
    142146    RTTHREAD        hSelf    = RTThreadSelfAutoAdopt();
    143     RTLockValidatorCheckOrder(pCritSect->s.Core.pValidatorRec, hSelf, 0, NULL, 0, NULL);
     147    int rc2 = RTLockValidatorCheckOrder(pCritSect->s.Core.pValidatorRec, hSelf, 0, NULL, 0, NULL);
     148    if (RT_FAILURE(rc2))
     149        return rc2;
    144150# else
    145151    RTTHREAD        hSelf    = RTThreadSelf();
     
    147153    for (;;)
    148154    {
    149         PDMCRITSECT_STRICT_BLOCK(hSelf, pCritSect->s.Core.pValidatorRec, !(pCritSect->s.Core.fFlags & RTCRITSECT_FLAGS_NO_NESTING));
     155        PDMCRITSECT_STRICT_BLOCK_RET(hSelf, pCritSect->s.Core.pValidatorRec, !(pCritSect->s.Core.fFlags & RTCRITSECT_FLAGS_NO_NESTING));
    150156        int rc = SUPSemEventWaitNoResume(pSession, hEvent, RT_INDEFINITE_WAIT);
    151157        PDMCRITSECT_STRICT_UNBLOCK(hSelf);
     
    403409        &&  pCritSect->s.Core.pValidatorRec
    404410        &&  pCritSect->s.Core.pValidatorRec->hThread != NIL_RTTHREAD)
    405         RTLockValidatorWriteLockDec(RTLockValidatorUnsetOwner(pCritSect->s.Core.pValidatorRec));
     411        RTLockValidatorUnsetOwner(pCritSect->s.Core.pValidatorRec);
    406412    return rc;
    407413}
     
    449455#  if defined(PDMCRITSECT_STRICT)
    450456        if (pCritSect->s.Core.pValidatorRec->hThread != NIL_RTTHREAD)
    451             RTLockValidatorWriteLockDec(RTLockValidatorUnsetOwner(pCritSect->s.Core.pValidatorRec));
     457            RTLockValidatorUnsetOwner(pCritSect->s.Core.pValidatorRec);
    452458#  endif
    453459        Assert(!pCritSect->s.Core.pValidatorRec || pCritSect->s.Core.pValidatorRec->hThread == NIL_RTTHREAD);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette