/* Checks the sorted timer list against the current system time. Signals any expired event timer. */
VOID EFIAPI CoreCheckTimers(IN EFI_EVENT CheckEvent, IN VOID *Context)
/* Checks the sorted timer list against the current system time. Signals any expired event timer. */
VOID EFIAPI CoreCheckTimers(IN EFI_EVENT CheckEvent, IN VOID *Context)
{
  UINT64  SystemTime;
  IEVENT  *Event;
  CoreAcquireLock (&mEfiTimerLock);
  SystemTime = CoreCurrentSystemTime ();
  while (!IsListEmpty (&mEfiTimerList)) {
    Event = CR (mEfiTimerList.ForwardLink, IEVENT, Timer.Link, EVENT_SIGNATURE);
    if (Event->Timer.TriggerTime > SystemTime) {
      break;
    }
    RemoveEntryList (&Event->Timer.Link);
    Event->Timer.Link.ForwardLink = NULL;
    CoreSignalEvent (Event);
    if (Event->Timer.Period != 0) {
      Event->Timer.TriggerTime = Event->Timer.TriggerTime + Event->Timer.Period;
      if (Event->Timer.TriggerTime <= SystemTime) {
        Event->Timer.TriggerTime = SystemTime;
        CoreSignalEvent (mEfiCheckTimerEvent);
      }
      CoreInsertEventTimer (Event);
    }
  }
  CoreReleaseLock (&mEfiTimerLock);
}