VirtualBox

Ignore:
Timestamp:
Dec 14, 2009 7:20:27 PM (15 years ago)
Author:
vboxsync
Message:

IPRT,PDMCritSect: More validation changes. Validate posix and linux mutexes. Always update the thread state with critsects.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/semnoint-generic.cpp

    r21337 r25373  
    126126RT_EXPORT_SYMBOL(RTSemMutexRequest);
    127127
     128
     129RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX Mutex, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     130{
     131    int rc;
     132    if (cMillies == RT_INDEFINITE_WAIT)
     133    {
     134        do rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
     135        while (rc == VERR_INTERRUPTED);
     136    }
     137    else
     138    {
     139        const uint64_t u64Start = RTTimeMilliTS();
     140        rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
     141        if (rc == VERR_INTERRUPTED)
     142        {
     143            do
     144            {
     145                uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
     146                if (u64Elapsed >= cMillies)
     147                    return VERR_TIMEOUT;
     148                rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies - (unsigned)u64Elapsed, uId, RT_SRC_POS_ARGS);
     149            } while (rc == VERR_INTERRUPTED);
     150        }
     151    }
     152    return rc;
     153}
     154RT_EXPORT_SYMBOL(RTSemMutexRequestDebug);
     155
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