when += avr->cycle;
- // find it's place int the list
+ // find its place in the list
int inserti = 0;
while (inserti < pool->count && pool->timer[inserti].when > when)
inserti++;
if (cnt)
memmove(&pool->timer[inserti + 1], &pool->timer[inserti],
cnt * sizeof(avr_cycle_timer_slot_t));
- pool->count++;
pool->timer[inserti].timer = timer;
pool->timer[inserti].param = param;
pool->timer[inserti].when = when;
+ pool->count++;
DEBUG(printf("%s %2d/%2d when %7d %p/%p\n", __func__, inserti, pool->count, (int)(when - avr->cycle), timer, param);)
DUMP(pool, "after");
}
avr_cycle_timer_cancel(avr, timer, param);
if (pool->count == MAX_CYCLE_TIMERS) {
- fprintf(stderr, "%s: pool is full (%d)!\n", __func__, MAX_CYCLE_TIMERS);
+ AVR_LOG(avr, LOG_ERROR, "CYCLE: %s: pool is full (%d)!\n", __func__, MAX_CYCLE_TIMERS);
return;
}
avr_cycle_timer_insert(avr, when, timer, param);
}
/*
- * run thru all the timers, call the ones that needs it,
+ * run through all the timers, call the ones that needs it,
* clear the ones that wants it, and calculate the next
* potential cycle we could sleep for...
*/