Changeset 54329 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Feb 20, 2015 2:11:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
r54328 r54329 3263 3263 3264 3264 /** 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 */ 3270 static 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(). 3266 3303 * 3267 3304 * @param pDevExt Pointer to the device instance data. … … 3374 3411 } 3375 3412 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 }3409 3413 3410 3414 #endif /* SUPDRV_USE_TSC_DELTA_THREAD */
Note:
See TracChangeset
for help on using the changeset viewer.