Changeset 93 for trunk/src/helpers/timer.c
- Timestamp:
- Aug 3, 2001, 8:52:44 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/timer.c
r91 r93 250 250 PLINKLIST pllXTimers = (PLINKLIST)pSet->pvllXTimers; 251 251 ULONG cTimers = lstCountItems(pllXTimers); 252 253 #ifdef DEBUG_XTIMERS 254 _Pmpf((__FUNCTION__ ": entering")); 255 #endif 256 252 257 if (!cTimers) 253 258 { … … 278 283 // only one timer: 279 284 // that's easy 285 #ifdef DEBUG_XTIMERS 286 _Pmpf((" got 1 timer")); 287 #endif 288 280 289 pSet->ulPMTimeout = pTimer1->ulTimeout; 281 290 } … … 285 294 // find the greatest common denominator 286 295 PXTIMER pTimer2 = (PXTIMER)pNode->pNext->pItemData; 296 #ifdef DEBUG_XTIMERS 297 _Pmpf((" got 2 timers")); 298 #endif 287 299 288 300 pSet->ulPMTimeout = mathGCD(pTimer1->ulTimeout, … … 297 309 i = 0; 298 310 299 // _Pmpf(("Recalculating, got %d timers", cTimers)); 311 #ifdef DEBUG_XTIMERS 312 _Pmpf((" got %d timers", cTimers)); 313 #endif 300 314 301 315 // fill an array of integers with the … … 305 319 pTimer1 = (PXTIMER)pNode->pItemData; 306 320 307 // _Pmpf((" timeout %d is %d", i, pTimer1->ulTimeout)); 321 #ifdef DEBUG_XTIMERS 322 _Pmpf((" timeout %d is %d", i, pTimer1->ulTimeout)); 323 #endif 308 324 309 325 paInts[i++] = pTimer1->ulTimeout; … … 314 330 pSet->ulPMTimeout = mathGCDMulti(paInts, 315 331 cTimers); 316 // _Pmpf(("--> GCD is %d", pSet->ulPMTimeout)); 317 } 332 } 333 334 #ifdef DEBUG_XTIMERS 335 _Pmpf(("--> GCD is %d", pSet->ulPMTimeout)); 336 #endif 318 337 319 338 if ( (!pSet->idPMTimerRunning) // timer not running? 320 339 || (pSet->ulPMTimeout != ulOldPMTimeout) // timeout changed? 321 340 ) 341 { 322 342 // start or restart PM timer 323 343 pSet->idPMTimerRunning = WinStartTimer(pSet->hab, … … 325 345 pSet->idPMTimer, 326 346 pSet->ulPMTimeout); 347 } 327 348 } 328 349 } … … 434 455 *@@changed V0.9.12 (2001-05-24) [umoeller]: fixed crash if this got called during tmrTimerTick 435 456 *@@changed V0.9.14 (2001-08-01) [umoeller]: fixed mem overwrite which might have caused crashes if this got called during tmrTimerTick 457 *@@changed V0.9.14 (2001-08-03) [umoeller]: fixed "half frequency" regression caused by frequency optimizations 436 458 */ 437 459 … … 475 497 &ulTimeNow, sizeof(ulTimeNow)); 476 498 499 #ifdef DEBUG_XTIMERS 500 _Pmpf((__FUNCTION__ ": ulTimeNow = %d", ulTimeNow)); 501 #endif 502 477 503 while (pTimerNode) 478 504 { … … 484 510 PXTIMER pTimer = (PXTIMER)pTimerNode->pItemData; 485 511 512 #ifdef DEBUG_XTIMERS 513 _Pmpf((" timer %d: ulNextFire = %d", 514 lstIndexFromItem(pllXTimers, pTimer), 515 pTimer->ulNextFire)); 516 #endif 517 486 518 if ( (pTimer) 487 && (pTimer->ulNextFire < ulTimeNow) 519 // && (pTimer->ulNextFire < ulTimeNow) 520 // V0.9.14 (2001-08-01) [umoeller] 521 // use <= because otherwise we'll get 522 // only half the frequency... 523 // we get here frequently where the 524 // two values are EXACTLY equal due 525 // to the above optimization (DosQuerySysInfo 526 // called once only for the entire loop) 527 && (pTimer->ulNextFire <= ulTimeNow) 488 528 ) 489 529 { 490 530 // this timer has elapsed: 491 531 // fire! 532 533 #ifdef DEBUG_XTIMERS 534 _Pmpf((" --> fire!")); 535 #endif 536 492 537 if (WinIsWindow(pSet->hab, 493 538 pTimer->hwndTarget))
Note:
See TracChangeset
for help on using the changeset viewer.