VirtualBox

Ignore:
Timestamp:
Feb 20, 2015 2:11:26 PM (10 years ago)
Author:
vboxsync
Message:

SUPDrvGip.cpp: Reordered the code, missed a bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrvGip.cpp

    r54328 r54329  
    32633263
    32643264/**
    3265  * Terminates the TSC-delta measurement thread.
     3265 * Waits for TSC-delta measurements to be completed for all online CPUs.
     3266 *
     3267 * @returns VBox status code.
     3268 * @param   pDevExt         Pointer to the device instance data.
     3269 */
     3270static int supdrvTscDeltaThreadWaitForOnlineCpus(PSUPDRVDEVEXT pDevExt)
     3271{
     3272    int cTriesLeft = 5;
     3273    int cMsTotalWait;
     3274    int cMsWaited = 0;
     3275    int cMsWaitGranularity = 1;
     3276
     3277    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
     3278    AssertReturn(pGip, VERR_INVALID_POINTER);
     3279
     3280    if (RT_UNLIKELY(pDevExt->hTscDeltaThread == NIL_RTTHREAD))
     3281        return VERR_THREAD_NOT_WAITABLE;
     3282
     3283    cMsTotalWait = RT_MIN(pGip->cPresentCpus + 10, 200);
     3284    while (cTriesLeft-- > 0)
     3285    {
     3286        if (RTCpuSetIsEqual(&pDevExt->TscDeltaObtainedCpuSet, &pGip->OnlineCpuSet))
     3287            return VINF_SUCCESS;
     3288        RTThreadSleep(cMsWaitGranularity);
     3289        cMsWaited += cMsWaitGranularity;
     3290        if (cMsWaited >= cMsTotalWait)
     3291            break;
     3292    }
     3293
     3294    return VERR_TIMEOUT;
     3295}
     3296
     3297
     3298/**
     3299 * Terminates the actual thread running supdrvTscDeltaThread().
     3300 *
     3301 * This is an internal worker function for supdrvTscDeltaThreadInit() and
     3302 * supdrvTscDeltaTerm().
    32663303 *
    32673304 * @param   pDevExt   Pointer to the device instance data.
     
    33743411}
    33753412
    3376 
    3377 /**
    3378  * Waits for TSC-delta measurements to be completed for all online CPUs.
    3379  *
    3380  * @returns VBox status code.
    3381  * @param   pDevExt         Pointer to the device instance data.
    3382  */
    3383 static int supdrvTscDeltaThreadWaitForOnlineCpus(PSUPDRVDEVEXT pDevExt)
    3384 {
    3385     int cTriesLeft = 5;
    3386     int cMsTotalWait;
    3387     int cMsWaited = 0;
    3388     int cMsWaitGranularity = 1;
    3389 
    3390     PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
    3391     AssertReturn(pGip, VERR_INVALID_POINTER);
    3392 
    3393     if (RT_UNLIKELY(pDevExt->hTscDeltaThread == NIL_RTTHREAD))
    3394         return VERR_THREAD_NOT_WAITABLE;
    3395 
    3396     cMsTotalWait = RT_MIN(pGip->cPresentCpus + 10, 200);
    3397     while (cTriesLeft-- > 0)
    3398     {
    3399         if (RTCpuSetIsEqual(&pDevExt->TscDeltaObtainedCpuSet, &pGip->OnlineCpuSet))
    3400             return VINF_SUCCESS;
    3401         RTThreadSleep(cMsWaitGranularity);
    3402         cMsWaited += cMsWaitGranularity;
    3403         if (cMsWaited >= cMsTotalWait)
    3404             break;
    3405     }
    3406 
    3407     return VERR_TIMEOUT;
    3408 }
    34093413
    34103414#endif /* SUPDRV_USE_TSC_DELTA_THREAD */
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