VirtualBox

Changeset 22957 in vbox


Ignore:
Timestamp:
Sep 11, 2009 1:04:19 PM (15 years ago)
Author:
vboxsync
Message:

Runtime/semmutex: fix timeout handling like in semevent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp

    r8651 r22957  
    173173    struct timespec ts;
    174174    struct timespec *pTimeout = NULL;
     175    uint64_t u64End = 0; /* shut up gcc */
    175176    if (cMillies != RT_INDEFINITE_WAIT)
    176177    {
    177178        ts.tv_sec  = cMillies / 1000;
    178179        ts.tv_nsec = (cMillies % 1000) * 1000000;
     180        u64End = RTTimeSystemNanoTS() + cMillies * 1000000;
    179181        pTimeout = &ts;
    180182    }
     
    226228                return RTErrConvertFromErrno(rc);
    227229            }
     230
     231            /* adjust the relative timeout */
     232            if (pTimeout)
     233            {
     234                int64_t u64Diff = u64End - RTTimeSystemNanoTS();
     235                if (u64Diff < 1000)
     236                {
     237                    rc = VERR_TIMEOUT;
     238                    break;
     239                }
     240                ts.tv_sec  = u64Diff / 1000000000;
     241                ts.tv_nsec = u64Diff % 1000000000;
     242            }
    228243        }
    229244
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