Changeset 53347 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Nov 18, 2014 4:09:52 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c
r52822 r53347 225 225 pCyclicHandler->cyh_level = CY_LOCK_LEVEL; 226 226 227 uint64_t u64Now = RTTime NanoTS();227 uint64_t u64Now = RTTimeSystemNanoTS(); 228 228 if (pTimer->pOmniTimer->u64When < u64Now) 229 229 pCyclicTime->cyt_when = u64Now + pTimer->interval / 2; … … 308 308 */ 309 309 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 310 329 ASMAtomicWriteU32(&pTimer->u32Magic, ~RTTIMER_MAGIC); 311 330 RTMemFree(pTimer); … … 342 361 */ 343 362 pTimer->pOmniTimer = pOmniTimer; 344 pOmniTimer->u64When = pTimer->interval + RTTime NanoTS();363 pOmniTimer->u64When = pTimer->interval + RTTimeSystemNanoTS(); 345 364 346 365 cyc_omni_handler_t hOmni; … … 382 401 } 383 402 384 pSingleTimer->hFireTime.cyt_when = u64First + RTTime NanoTS();403 pSingleTimer->hFireTime.cyt_when = u64First + RTTimeSystemNanoTS(); 385 404 if (pTimer->interval == 0) 386 405 { … … 414 433 return VERR_TIMER_SUSPENDED; 415 434 416 pTimer->fSuspended = true; 417 if (pTimer->pSingleTimer) 418 { 419 mutex_enter(&cpu_lock); 420 cyclic_remove(pTimer->hCyclicId); 421 mutex_exit(&cpu_lock); 422 RTMemFree(pTimer->pSingleTimer); 423 } 424 else if (pTimer->pOmniTimer) 425 { 426 mutex_enter(&cpu_lock); 427 cyclic_remove(pTimer->hCyclicId); 428 mutex_exit(&cpu_lock); 429 RTMemFree(pTimer->pOmniTimer->au64Ticks); 430 RTMemFree(pTimer->pOmniTimer); 431 } 432 433 return VINF_SUCCESS; 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; 434 443 } 435 444 … … 439 448 RTTIMER_ASSERT_VALID_RET(pTimer); 440 449 441 /** @todo implement me! */ 442 443 return VERR_NOT_SUPPORTED; 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; 444 462 } 445 463
Note:
See TracChangeset
for help on using the changeset viewer.