Logo Search packages:      
Sourcecode: scummvm version File versions

void DefaultTimerManager::handler (  ) [inherited]

Timer callback, to be invoked at regular time intervals by the backend.

Definition at line 84 of file default-timer.cpp.

References OSystem::getMillis().

Referenced by OSystem_Dreamcast::delayMillis(), and OSystem_Dreamcast::pollEvent().

                                  {
      Common::StackLock lock(_mutex);

      const uint32 curTime = g_system->getMillis();

      // Repeat as long as there is a TimerSlot that is scheduled to fire.
      TimerSlot *slot = _head->next;
      while (slot && slot->nextFireTime < curTime) {
            // Remove the slot from the priority queue
            _head->next = slot->next;

            // Update the fire time and reinsert the TimerSlot into the priority
            // queue.
            assert(slot->interval > 0);
            slot->nextFireTime += (slot->interval / 1000);
            slot->nextFireTimeMicro += (slot->interval % 1000);
            if (slot->nextFireTimeMicro > 1000) {
                  slot->nextFireTime += slot->nextFireTimeMicro / 1000;
                  slot->nextFireTimeMicro %= 1000;
            }
            insertPrioQueue(_head, slot);

            // Invoke the timer callback
            assert(slot->callback);
            slot->callback(slot->refCon);

            // Look at the next scheduled timer
            slot = _head->next;
      }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index