VirtualBox

Changeset 53403 in vbox for trunk/src


Ignore:
Timestamp:
Nov 26, 2014 3:34:33 PM (10 years ago)
Author:
vboxsync
Message:

Runtime/r0drv/solaris: Revert r96951, reprogramming the cyclic doesn't quite work the way it ought it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c

    r53347 r53403  
    308308     */
    309309    RTTimerStop(pTimer);
    310 
    311     /** @remarks Do -not- call this function from a timer callback,
    312      *           cyclic_remove() will deadlock the system. */
    313     if (pTimer->pSingleTimer)
    314     {
    315         mutex_enter(&cpu_lock);
    316         cyclic_remove(pTimer->hCyclicId);
    317         mutex_exit(&cpu_lock);
    318         RTMemFree(pTimer->pSingleTimer);
    319     }
    320     else if (pTimer->pOmniTimer)
    321     {
    322         mutex_enter(&cpu_lock);
    323         cyclic_remove(pTimer->hCyclicId);
    324         mutex_exit(&cpu_lock);
    325         RTMemFree(pTimer->pOmniTimer->au64Ticks);
    326         RTMemFree(pTimer->pOmniTimer);
    327     }
    328 
    329310    ASMAtomicWriteU32(&pTimer->u32Magic, ~RTTIMER_MAGIC);
    330311    RTMemFree(pTimer);
     
    433414        return VERR_TIMER_SUSPENDED;
    434415
    435     /*
    436      * Solaris does not allow removing cyclics from the timer callback but it does allow
    437      * reprogramming the cyclic. Reprogram such that it never expires.
    438      */
    439     int rc = RTTimerChangeInterval(pTimer, CY_INFINITY);
    440     if (RT_SUCCESS(rc))
    441         pTimer->fSuspended = true;
    442     return rc;
     416    /** @remarks Do -not- call this function from a timer callback,
     417     *           cyclic_remove() will deadlock the system. */
     418    pTimer->fSuspended = true;
     419    if (pTimer->pSingleTimer)
     420    {
     421        mutex_enter(&cpu_lock);
     422        cyclic_remove(pTimer->hCyclicId);
     423        mutex_exit(&cpu_lock);
     424        RTMemFree(pTimer->pSingleTimer);
     425    }
     426    else if (pTimer->pOmniTimer)
     427    {
     428        mutex_enter(&cpu_lock);
     429        cyclic_remove(pTimer->hCyclicId);
     430        mutex_exit(&cpu_lock);
     431        RTMemFree(pTimer->pOmniTimer->au64Ticks);
     432        RTMemFree(pTimer->pOmniTimer);
     433    }
     434    return VINF_SUCCESS;
    443435}
    444436
     
    446438RTDECL(int) RTTimerChangeInterval(PRTTIMER pTimer, uint64_t u64NanoInterval)
    447439{
    448     RTTIMER_ASSERT_VALID_RET(pTimer);
    449 
    450     if (pTimer->hCyclicId != CYCLIC_NONE)
    451     {
    452         uint64_t uNanoTS = RTTimeSystemNanoTS();
    453         if (   u64NanoInterval >= CY_INFINITY
    454             || uNanoTS >= CY_INFINITY - u64NanoInterval)
    455             cyclic_reprogram(pTimer->hCyclicId, CY_INFINITY);
    456         else
    457             cyclic_reprogram(pTimer->hCyclicId, (hrtime_t)(u64NanoInterval + uNanoTS));
    458 
    459         return VINF_SUCCESS;
    460     }
    461     return VERR_INVALID_STATE;
     440    return VERR_NOT_SUPPORTED;
    462441}
    463442
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