VirtualBox

Ignore:
Timestamp:
Oct 15, 2010 11:36:00 AM (14 years ago)
Author:
vboxsync
Message:

IPRT/r0drv/solaris: Some more adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h

    r33149 r33150  
    3535#include <iprt/time.h>
    3636
     37
     38/** The resolution (nanoseconds) specified when using timeout_generic. */
     39#define RTR0SEMSOLWAIT_RESOLUTION   50000
     40
     41
    3742/**
    3843 * Solaris semaphore wait structure.
     
    4045typedef struct RTR0SEMSOLWAIT
    4146{
    42     /** The absolute timeout given as nano seconds since the start of the
     47    /** The absolute timeout given as nanoseconds since the start of the
    4348     *  monotonic clock. */
    4449    uint64_t        uNsAbsTimeout;
    45     /** The timeout in nano seconds relative to the start of the wait. */
     50    /** The timeout in nanoseconds relative to the start of the wait. */
    4651    uint64_t        cNsRelTimeout;
    4752    /** The native timeout value. */
     
    213218DECLINLINE(void) rtR0SemSolWaitDoIt(PRTR0SEMSOLWAIT pWait, kcondvar_t *pCnd, kmutex_t *pMtx)
    214219{
    215     int rc = 1;
    216220    union
    217221    {
     
    235239                 */
    236240                u.idCo = g_pfnrtR0Sol_timeout_generic(CALLOUT_REALTIME, rtR0SemSolWaitTimeout, pWait,
    237                                                       pWait->uNsAbsTimeout, 50000 /*res*/,
     241                                                      pWait->uNsAbsTimeout, RTR0SEMSOLWAIT_RESOLUTION,
    238242                                                      CALLOUT_FLAG_ABSOLUTE);
    239243            }
     
    271275    /*
    272276     * Do the waiting.
     277     * (rc > 0 - normal wake-up; rc == 0 - interruption; rc == -1 - timeout)
    273278     */
     279    int rc;
    274280    if (pWait->fInterruptible)
    275         rc = cv_wait_sig(pCnd, pMtx);
     281    {
     282        int rc = cv_wait_sig(pCnd, pMtx);
     283        if (RT_UNLIKELY(rc <= 0))
     284        {
     285            if (RT_LIKELY(rc == 0))
     286                pWait->fInterrupted = true;
     287            else
     288                AssertMsgFailed(("rc=%d\n", rc)); /* no timeouts, see above! */
     289        }
     290    }
    276291    else
    277292        cv_wait(pCnd, pMtx);
     
    306321        mutex_enter(pMtx);
    307322    }
    308 
    309     /*
    310      * Above zero means normal wake-up.
    311      * Interruption is signalled by 0, timeouts by -1.
    312      */
    313     if (RT_UNLIKELY(rc <= 0))
    314     {
    315         if (RT_LIKELY(rc == 0))
    316             pWait->fInterrupted = true;
    317         else
    318             AssertMsgFailed(("rc=%d\n", rc)); /* no timeouts, see above! */
    319     }
    320323}
    321324
     
    355358    pWait->pThread = NULL;
    356359}
     360
    357361
    358362/**
     
    390394}
    391395
     396
     397/**
     398 * Gets the max resolution of the timeout machinery.
     399 *
     400 * @returns Resolution specified in nanoseconds.
     401 */
     402DECLINLINE(uint32_t) rtR0SemSolWaitGetResolution(void)
     403{
     404    return g_pfnrtR0Sol_timeout_generic != NULL
     405         ? RTR0SEMSOLWAIT_RESOLUTION
     406         : cyclic_getres();
     407}
     408
    392409#endif
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