ext/iodine/fio.c
/** Places a timer in an ordered linked list. */
Places a timer in an ordered linked list.
Places a timer in an ordered linked list .
static void fio_timer_add_order(fio_timer_s *timer) {
  timer->due = fio_timer_calc_due(timer->interval);
  fio_lock(&fio_timer_lock);
  FIO_LS_EMBD_FOR(&fio_timers, node) {
    fio_timer_s *t2 = FIO_LS_EMBD_OBJ(fio_timer_s, node, node);
    if (fio_timer_compare(timer->due, t2->due) >= 0) {
      fio_ls_embd_push(node, &timer->node);
      goto finish;
    }
  }
  fio_ls_embd_push(&fio_timers, &timer->node);
finish:
  fio_unlock(&fio_timer_lock);
}
static void fio_timer_add_order ( fio_timer_s * timer ) { timer -> due = fio_timer_calc_due ( timer -> interval ) ; fio_lock ( & fio_timer_lock ) ; FIO_LS_EMBD_FOR ( & fio_timers , node ) { fio_timer_s * t2 = FIO_LS_EMBD_OBJ ( fio_timer_s , node , node ) ; if ( fio_timer_compare ( timer -> due , t2 -> due ) >= 0 ) { fio_ls_embd_push ( node , & timer -> node ) ; goto finish ; } } fio_ls_embd_push ( & fio_timers , & timer -> node ) ; finish : fio_unlock ( & fio_timer_lock ) ; }
Places a timer in an ordered linked list.
Places a timer in an ordered linked list .
// fio_ls_embd_s *pos = &fio_timers;