VirtualBox

Changeset 25724 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Jan 11, 2010 2:45:34 PM (15 years ago)
Author:
vboxsync
Message:

iprt: Use RTMSINTERVAL for timeouts. Fixed missing timeout underflow checks in two RTFileAioCtxWait implementations.

Location:
trunk/src/VBox/Runtime/r3
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp

    r25645 r25724  
    472472}
    473473
    474 RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, unsigned cMillisTimeout,
     474RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
    475475                             PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs)
    476476{
     
    498498    struct timespec     Timeout = {0,0};
    499499    uint64_t            StartNanoTS = 0;
    500     if (cMillisTimeout != RT_INDEFINITE_WAIT)
    501     {
    502         Timeout.tv_sec  = cMillisTimeout / 1000;
    503         Timeout.tv_nsec = cMillisTimeout % 1000 * 1000000;
     500    if (cMillies != RT_INDEFINITE_WAIT)
     501    {
     502        Timeout.tv_sec  = cMillies / 1000;
     503        Timeout.tv_nsec = cMillies % 1000 * 1000000;
    504504        pTimeout = &Timeout;
    505505        StartNanoTS = RTTimeNanoTS();
     
    573573        cReqs    -= cDone;
    574574
    575         if (cMillisTimeout != RT_INDEFINITE_WAIT)
     575        if (cMillies != RT_INDEFINITE_WAIT)
    576576        {
    577577            /* The API doesn't return ETIMEDOUT, so we have to fix that ourselves. */
    578578            uint64_t NanoTS = RTTimeNanoTS();
    579579            uint64_t cMilliesElapsed = (NanoTS - StartNanoTS) / 1000000;
    580             if (cMilliesElapsed >= cMillisTimeout)
     580            if (cMilliesElapsed >= cMillies)
    581581            {
    582582                rc = VERR_TIMEOUT;
     
    585585
    586586            /* The syscall supposedly updates it, but we're paranoid. :-) */
    587             Timeout.tv_sec  = (cMillisTimeout - (unsigned)cMilliesElapsed) / 1000;
    588             Timeout.tv_nsec = (cMillisTimeout - (unsigned)cMilliesElapsed) % 1000 * 1000000;
     587            Timeout.tv_sec  = (cMillies - (RTMSINTERVAL)cMilliesElapsed) / 1000;
     588            Timeout.tv_nsec = (cMillies - (RTMSINTERVAL)cMilliesElapsed) % 1000 * 1000000;
    589589        }
    590590    }
  • trunk/src/VBox/Runtime/r3/linux/fileaio-linux.cpp

    r25645 r25724  
    647647
    648648
    649 RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, unsigned cMillisTimeout,
     649RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
    650650                             PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs)
    651651{
     
    673673    struct timespec     Timeout = {0,0};
    674674    uint64_t            StartNanoTS = 0;
    675     if (cMillisTimeout != RT_INDEFINITE_WAIT)
     675    if (cMillies != RT_INDEFINITE_WAIT)
    676676    {
    677         Timeout.tv_sec  = cMillisTimeout / 1000;
    678         Timeout.tv_nsec = cMillisTimeout % 1000 * 1000000;
     677        Timeout.tv_sec  = cMillies / 1000;
     678        Timeout.tv_nsec = cMillies % 1000 * 1000000;
    679679        pTimeout = &Timeout;
    680680        StartNanoTS = RTTimeNanoTS();
     
    747747        cReqs    -= cDone;
    748748
    749         if (cMillisTimeout != RT_INDEFINITE_WAIT)
     749        if (cMillies != RT_INDEFINITE_WAIT)
    750750        {
    751751            /* The API doesn't return ETIMEDOUT, so we have to fix that ourselves. */
    752752            uint64_t NanoTS = RTTimeNanoTS();
    753753            uint64_t cMilliesElapsed = (NanoTS - StartNanoTS) / 1000000;
    754             if (cMilliesElapsed >= cMillisTimeout)
     754            if (cMilliesElapsed >= cMillies)
    755755            {
    756756                rc = VERR_TIMEOUT;
     
    759759
    760760            /* The syscall supposedly updates it, but we're paranoid. :-) */
    761             Timeout.tv_sec  = (cMillisTimeout - (unsigned)cMilliesElapsed) / 1000;
    762             Timeout.tv_nsec = (cMillisTimeout - (unsigned)cMilliesElapsed) % 1000 * 1000000;
     761            Timeout.tv_sec  = (cMillies - (RTMSINTERVAL)cMilliesElapsed) / 1000;
     762            Timeout.tv_nsec = (cMillies - (RTMSINTERVAL)cMilliesElapsed) % 1000 * 1000000;
    763763        }
    764764    }
  • trunk/src/VBox/Runtime/r3/linux/semevent-linux.cpp

    r25717 r25724  
    219219
    220220
    221 static int rtSemEventWait(RTSEMEVENT hEventSem, unsigned cMillies, bool fAutoResume)
     221static int rtSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies, bool fAutoResume)
    222222{
    223223    PCRTLOCKVALSRCPOS pSrcPos = NULL;
     
    331331
    332332
    333 RTDECL(int)  RTSemEventWait(RTSEMEVENT hEventSem, unsigned cMillies)
     333RTDECL(int)  RTSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies)
    334334{
    335335    int rc = rtSemEventWait(hEventSem, cMillies, true);
     
    340340
    341341
    342 RTDECL(int)  RTSemEventWaitNoResume(RTSEMEVENT hEventSem, unsigned cMillies)
     342RTDECL(int)  RTSemEventWaitNoResume(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies)
    343343{
    344344    return rtSemEventWait(hEventSem, cMillies, false);
  • trunk/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp

    r25720 r25724  
    242242
    243243
    244 static int rtSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies, bool fAutoResume)
     244static int rtSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies, bool fAutoResume)
    245245{
    246246    PCRTLOCKVALSRCPOS pSrcPos = NULL;
     
    354354
    355355
    356 RTDECL(int)  RTSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies)
     356RTDECL(int)  RTSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies)
    357357{
    358358    int rc = rtSemEventMultiWait(hEventMultiSem, cMillies, true);
     
    362362
    363363
    364 RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies)
     364RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies)
    365365{
    366366    return rtSemEventMultiWait(hEventMultiSem, cMillies, false);
  • trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp

    r25721 r25724  
    194194
    195195
    196 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX hMutexSem, unsigned cMillies, bool fAutoResume, PCRTLOCKVALSRCPOS pSrcPos)
     196DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, bool fAutoResume, PCRTLOCKVALSRCPOS pSrcPos)
    197197{
    198198    /*
     
    343343
    344344#undef RTSemMutexRequest
    345 RTDECL(int) RTSemMutexRequest(RTSEMMUTEX hMutexSem, unsigned cMillies)
     345RTDECL(int) RTSemMutexRequest(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies)
    346346{
    347347#ifndef RTSEMMUTEX_STRICT
     
    356356
    357357
    358 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX hMutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     358RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    359359{
    360360    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
     
    366366
    367367#undef RTSemMutexRequestNoResume
    368 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, unsigned cMillies)
     368RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies)
    369369{
    370370#ifndef RTSEMMUTEX_STRICT
     
    377377
    378378
    379 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX hMutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     379RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    380380{
    381381    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
  • trunk/src/VBox/Runtime/r3/os2/sems-os2.cpp

    r25721 r25724  
    8989
    9090
    91 RTDECL(int)   RTSemEventWaitNoResume(RTSEMEVENT hEventSem, unsigned cMillies)
     91RTDECL(int)   RTSemEventWaitNoResume(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies)
    9292{
    9393    /*
     
    226226
    227227
    228 RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies)
     228RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies)
    229229{
    230230    /*
     
    327327
    328328#undef RTSemMutexRequestNoResume
    329 RTDECL(int)  RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, unsigned cMillies)
     329RTDECL(int)  RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies)
    330330{
    331331    /*
  • trunk/src/VBox/Runtime/r3/os2/thread-os2.cpp

    r16311 r25724  
    176176
    177177
    178 RTDECL(int)   RTThreadSleep(unsigned cMillies)
     178RTDECL(int)   RTThreadSleep(RTMSINTERVAL cMillies)
    179179{
    180180    LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
  • trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp

    r25645 r25724  
    807807
    808808
    809 RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, unsigned cMillisTimeout,
     809RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
    810810                             PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs)
    811811{
     
    832832        return VERR_INVALID_PARAMETER;
    833833
    834     if (cMillisTimeout != RT_INDEFINITE_WAIT)
     834    if (cMillies != RT_INDEFINITE_WAIT)
    835835    {
    836         Timeout.tv_sec  = cMillisTimeout / 1000;
    837         Timeout.tv_nsec = (cMillisTimeout % 1000) * 1000000;
     836        Timeout.tv_sec  = cMillies / 1000;
     837        Timeout.tv_nsec = (cMillies % 1000) * 1000000;
    838838        pTimeout = &Timeout;
    839839        StartNanoTS = RTTimeNanoTS();
     
    964964                break;
    965965
    966             if (cMillisTimeout != RT_INDEFINITE_WAIT)
     966            if (cMillies != RT_INDEFINITE_WAIT)
    967967            {
    968968                uint64_t TimeDiff;
     
    970970                /* Recalculate the timeout. */
    971971                TimeDiff = RTTimeSystemNanoTS() - StartNanoTS;
    972                 Timeout.tv_sec = Timeout.tv_sec - (TimeDiff / 1000000);
     972                Timeout.tv_sec  = Timeout.tv_sec - (TimeDiff / 1000000);
    973973                Timeout.tv_nsec = Timeout.tv_nsec - (TimeDiff % 1000000);
    974974            }
  • trunk/src/VBox/Runtime/r3/posix/semevent-posix.cpp

    r25717 r25724  
    288288
    289289
    290 DECL_FORCE_INLINE(int) rtSemEventWait(RTSEMEVENT hEventSem, unsigned cMillies, bool fAutoResume)
     290DECL_FORCE_INLINE(int) rtSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies, bool fAutoResume)
    291291{
    292292    PCRTLOCKVALSRCPOS  pSrcPos = NULL;
     
    464464
    465465
    466 RTDECL(int)  RTSemEventWait(RTSEMEVENT hEventSem, unsigned cMillies)
     466RTDECL(int)  RTSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies)
    467467{
    468468    int rc = rtSemEventWait(hEventSem, cMillies, true);
     
    472472
    473473
    474 RTDECL(int)  RTSemEventWaitNoResume(RTSEMEVENT hEventSem, unsigned cMillies)
     474RTDECL(int)  RTSemEventWaitNoResume(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies)
    475475{
    476476    return rtSemEventWait(hEventSem, cMillies, false);
  • trunk/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp

    r25720 r25724  
    323323
    324324
    325 static int rtSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies, bool fAutoResume)
     325static int rtSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies, bool fAutoResume)
    326326{
    327327    PCRTLOCKVALSRCPOS pSrcPos = NULL;
     
    495495
    496496
    497 RTDECL(int)  RTSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies)
     497RTDECL(int)  RTSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies)
    498498{
    499499    int rc = rtSemEventMultiWait(hEventMultiSem, cMillies, true);
     
    503503
    504504
    505 RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies)
     505RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies)
    506506{
    507507    return rtSemEventMultiWait(hEventMultiSem, cMillies, false);
  • trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp

    r25721 r25724  
    180180
    181181
    182 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX hMutexSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos)
     182DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, PCRTLOCKVALSRCPOS pSrcPos)
    183183{
    184184    /*
     
    281281
    282282#undef RTSemMutexRequest
    283 RTDECL(int) RTSemMutexRequest(RTSEMMUTEX hMutexSem, unsigned cMillies)
     283RTDECL(int) RTSemMutexRequest(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies)
    284284{
    285285#ifndef RTSEMMUTEX_STRICT
     
    292292
    293293
    294 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX hMutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     294RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    295295{
    296296    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
     
    300300
    301301#undef RTSemMutexRequestNoResume
    302 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, unsigned cMillies)
     302RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies)
    303303{
    304304    /* (EINTR isn't returned by the wait functions we're using.) */
     
    312312
    313313
    314 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX hMutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     314RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    315315{
    316316    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
  • trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp

    r25638 r25724  
    266266
    267267
    268 RTDECL(int) RTThreadSleep(unsigned cMillies)
     268RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
    269269{
    270270    LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
  • trunk/src/VBox/Runtime/r3/solaris/fileaio-solaris.cpp

    r25645 r25724  
    433433}
    434434
    435 RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, unsigned cMillisTimeout,
     435RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
    436436                             PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs)
    437437{
     
    459459    struct timespec     Timeout = {0,0};
    460460    uint64_t            StartNanoTS = 0;
    461     if (cMillisTimeout != RT_INDEFINITE_WAIT)
    462     {
    463         Timeout.tv_sec  = cMillisTimeout / 1000;
    464         Timeout.tv_nsec = cMillisTimeout % 1000 * 1000000;
     461    if (cMillies != RT_INDEFINITE_WAIT)
     462    {
     463        Timeout.tv_sec  = cMillies / 1000;
     464        Timeout.tv_nsec = cMillies % 1000 * 1000000;
    465465        pTimeout = &Timeout;
    466466        StartNanoTS = RTTimeNanoTS();
     
    517517        cReqs    -= cRequests;
    518518
    519         if (cMillisTimeout != RT_INDEFINITE_WAIT)
     519        if (cMillies != RT_INDEFINITE_WAIT)
    520520        {
    521521            uint64_t NanoTS = RTTimeNanoTS();
     
    523523
    524524            /* The syscall supposedly updates it, but we're paranoid. :-) */
    525             Timeout.tv_sec  = (cMillisTimeout - (unsigned)cMilliesElapsed) / 1000;
    526             Timeout.tv_nsec = (cMillisTimeout - (unsigned)cMilliesElapsed) % 1000 * 1000000;
     525            if (cMilliesElapsed < cMillies)
     526            {
     527                Timeout.tv_sec  = (cMillies - (RTMSINTERVAL)cMilliesElapsed) / 1000;
     528                Timeout.tv_nsec = (cMillies - (RTMSINTERVAL)cMilliesElapsed) % 1000 * 1000000;
     529            }
     530            else
     531            {
     532                Timeout.tv_sec  = 0;
     533                Timeout.tv_nsec = 0;
     534            }
    527535        }
    528536    }
  • trunk/src/VBox/Runtime/r3/tcp.cpp

    r25000 r25724  
    882882
    883883
    884 RTR3DECL(int)  RTTcpSelectOne(RTSOCKET Sock, unsigned cMillies)
     884RTR3DECL(int)  RTTcpSelectOne(RTSOCKET Sock, RTMSINTERVAL cMillies)
    885885{
    886886    fd_set fdsetR;
  • trunk/src/VBox/Runtime/r3/win/fileaio-win.cpp

    r25645 r25724  
    386386}
    387387
    388 RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, unsigned cMillisTimeout,
     388RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
    389389                             PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs)
    390390{
     
    417417    int cRequestsCompleted = 0;
    418418    while (   !pCtxInt->fWokenUp
    419            && (cMinReqs > 0))
     419           && cMinReqs > 0)
    420420    {
    421421        uint64_t     StartNanoTS = 0;
    422         DWORD        dwTimeout = cMillisTimeout == RT_INDEFINITE_WAIT ? INFINITE : cMillisTimeout;
     422        DWORD        dwTimeout = cMillies == RT_INDEFINITE_WAIT ? INFINITE : cMillies;
    423423        DWORD        cbTransfered;
    424424        LPOVERLAPPED pOverlapped;
     
    426426        BOOL         fSucceeded;
    427427
    428         if (cMillisTimeout != RT_INDEFINITE_WAIT)
     428        if (cMillies != RT_INDEFINITE_WAIT)
    429429            StartNanoTS = RTTimeNanoTS();
    430430
     
    446446        if (lCompletionKey == AIO_CONTEXT_WAKEUP_EVENT)
    447447            break;
    448         else
     448
     449        /* A request completed. */
     450        PRTFILEAIOREQINTERNAL pReqInt = OVERLAPPED_2_RTFILEAIOREQINTERNAL(pOverlapped);
     451        AssertPtr(pReqInt);
     452        Assert(pReqInt->u32Magic == RTFILEAIOREQ_MAGIC);
     453
     454        /* Mark the request as finished. */
     455        RTFILEAIOREQ_SET_STATE(pReqInt, COMPLETED);
     456
     457        /* completion status. */
     458        DWORD cbTransfered;
     459        fSucceeded = GetOverlappedResult(pReqInt->hFile,
     460                                         &pReqInt->Overlapped,
     461                                         &cbTransfered,
     462                                         FALSE);
     463        pReqInt->cbTransfered = cbTransfered;
     464        pReqInt->Rc = VINF_SUCCESS;
     465
     466        pahReqs[cRequestsCompleted++] = (RTFILEAIOREQ)pReqInt;
     467
     468        /* Update counter. */
     469        cMinReqs--;
     470
     471        if (cMillies != RT_INDEFINITE_WAIT)
    449472        {
    450             /* A request completed. */
    451             PRTFILEAIOREQINTERNAL pReqInt = OVERLAPPED_2_RTFILEAIOREQINTERNAL(pOverlapped);
    452             AssertPtr(pReqInt);
    453             Assert(pReqInt->u32Magic == RTFILEAIOREQ_MAGIC);
    454 
    455             /* Mark the request as finished. */
    456             RTFILEAIOREQ_SET_STATE(pReqInt, COMPLETED);
    457 
    458             /* completion status. */
    459             DWORD cbTransfered;
    460             fSucceeded = GetOverlappedResult(pReqInt->hFile,
    461                                              &pReqInt->Overlapped,
    462                                              &cbTransfered,
    463                                              FALSE);
    464             pReqInt->cbTransfered = cbTransfered;
    465             pReqInt->Rc = VINF_SUCCESS;
    466 
    467             pahReqs[cRequestsCompleted++] = (RTFILEAIOREQ)pReqInt;
    468 
    469             /* Update counter. */
    470             cMinReqs --;
    471 
    472             if (cMillisTimeout != RT_INDEFINITE_WAIT)
    473             {
    474                 /* Recalculate timeout. */
    475                 uint64_t NanoTS = RTTimeNanoTS();
    476                 uint64_t cMilliesElapsed = (NanoTS - StartNanoTS) / 1000000;
    477                 cMillisTimeout -= cMilliesElapsed;
    478             }
     473            /* Recalculate timeout. */
     474            uint64_t NanoTS = RTTimeNanoTS();
     475            uint64_t cMilliesElapsed = (NanoTS - StartNanoTS) / 1000000;
     476            if (cMilliesElapsed < cMillies)
     477                cMillies -= cMilliesElapsed;
     478            else
     479                cMillies = 0;
    479480        }
    480481    }
  • trunk/src/VBox/Runtime/r3/win/semevent-win.cpp

    r25717 r25724  
    197197
    198198#undef RTSemEventWaitNoResume
    199 RTDECL(int)   RTSemEventWaitNoResume(RTSEMEVENT hEventSem, unsigned cMillies)
     199RTDECL(int)   RTSemEventWaitNoResume(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies)
    200200{
    201201    PCRTLOCKVALSRCPOS pSrcPos = NULL;
  • trunk/src/VBox/Runtime/r3/win/semeventmulti-win.cpp

    r25720 r25724  
    221221
    222222#undef RTSemEventMultiWaitNoResume
    223 RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, unsigned cMillies)
     223RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies)
    224224{
    225225    PCRTLOCKVALSRCPOS pSrcPos = NULL;
  • trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp

    r25721 r25724  
    174174 * @param   pSrcPos             The source position of the caller.
    175175 */
    176 DECL_FORCE_INLINE(int) rtSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos)
     176DECL_FORCE_INLINE(int) rtSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, PCRTLOCKVALSRCPOS pSrcPos)
    177177{
    178178    /*
     
    251251
    252252#undef RTSemMutexRequestNoResume
    253 RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, unsigned cMillies)
     253RTDECL(int) RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies)
    254254{
    255255#ifndef RTSEMMUTEX_STRICT
     
    262262
    263263
    264 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX hMutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     264RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    265265{
    266266    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
  • trunk/src/VBox/Runtime/r3/win/thread-win.cpp

    r13837 r25724  
    146146
    147147
    148 RTR3DECL(int)   RTThreadSleep(unsigned cMillies)
     148RTR3DECL(int)   RTThreadSleep(RTMSINTERVAL cMillies)
    149149{
    150150    LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
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