Ignore:
Timestamp:
Aug 3, 2001, 8:52:44 PM (24 years ago)
Author:
umoeller
Message:

Misc changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/timer.c

    r91 r93  
    250250    PLINKLIST pllXTimers = (PLINKLIST)pSet->pvllXTimers;
    251251    ULONG   cTimers = lstCountItems(pllXTimers);
     252
     253    #ifdef DEBUG_XTIMERS
     254        _Pmpf((__FUNCTION__ ": entering"));
     255    #endif
     256
    252257    if (!cTimers)
    253258    {
     
    278283            // only one timer:
    279284            // that's easy
     285            #ifdef DEBUG_XTIMERS
     286                _Pmpf(("  got 1 timer"));
     287            #endif
     288
    280289            pSet->ulPMTimeout = pTimer1->ulTimeout;
    281290        }
     
    285294            // find the greatest common denominator
    286295            PXTIMER pTimer2 = (PXTIMER)pNode->pNext->pItemData;
     296            #ifdef DEBUG_XTIMERS
     297                _Pmpf(("  got 2 timers"));
     298            #endif
    287299
    288300            pSet->ulPMTimeout = mathGCD(pTimer1->ulTimeout,
     
    297309                    i = 0;
    298310
    299             // _Pmpf(("Recalculating, got %d timers", cTimers));
     311            #ifdef DEBUG_XTIMERS
     312                _Pmpf(("  got %d timers", cTimers));
     313            #endif
    300314
    301315            // fill an array of integers with the
     
    305319                pTimer1 = (PXTIMER)pNode->pItemData;
    306320
    307                 // _Pmpf(("  timeout %d is %d", i, pTimer1->ulTimeout));
     321                #ifdef DEBUG_XTIMERS
     322                    _Pmpf(("    timeout %d is %d", i, pTimer1->ulTimeout));
     323                #endif
    308324
    309325                paInts[i++] = pTimer1->ulTimeout;
     
    314330            pSet->ulPMTimeout = mathGCDMulti(paInts,
    315331                                             cTimers);
    316             // _Pmpf(("--> GCD is %d", pSet->ulPMTimeout));
    317         }
     332        }
     333
     334        #ifdef DEBUG_XTIMERS
     335            _Pmpf(("--> GCD is %d", pSet->ulPMTimeout));
     336        #endif
    318337
    319338        if (    (!pSet->idPMTimerRunning)       // timer not running?
    320339             || (pSet->ulPMTimeout != ulOldPMTimeout) // timeout changed?
    321340           )
     341        {
    322342            // start or restart PM timer
    323343            pSet->idPMTimerRunning = WinStartTimer(pSet->hab,
     
    325345                                                   pSet->idPMTimer,
    326346                                                   pSet->ulPMTimeout);
     347        }
    327348    }
    328349}
     
    434455 *@@changed V0.9.12 (2001-05-24) [umoeller]: fixed crash if this got called during tmrTimerTick
    435456 *@@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
    436458 */
    437459
     
    475497                                    &ulTimeNow, sizeof(ulTimeNow));
    476498
     499                    #ifdef DEBUG_XTIMERS
     500                        _Pmpf((__FUNCTION__ ": ulTimeNow = %d", ulTimeNow));
     501                    #endif
     502
    477503                    while (pTimerNode)
    478504                    {
     
    484510                        PXTIMER pTimer = (PXTIMER)pTimerNode->pItemData;
    485511
     512                        #ifdef DEBUG_XTIMERS
     513                            _Pmpf(("   timer %d: ulNextFire = %d",
     514                                    lstIndexFromItem(pllXTimers, pTimer),
     515                                    pTimer->ulNextFire));
     516                        #endif
     517
    486518                        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)
    488528                           )
    489529                        {
    490530                            // this timer has elapsed:
    491531                            // fire!
     532
     533                            #ifdef DEBUG_XTIMERS
     534                                _Pmpf(("   --> fire!"));
     535                            #endif
     536
    492537                            if (WinIsWindow(pSet->hab,
    493538                                            pTimer->hwndTarget))
Note: See TracChangeset for help on using the changeset viewer.