11#ifndef UTILS_GP_TIMER_H
12#define UTILS_GP_TIMER_H
16#include <input/gp_types.h>
21#define GP_TIMER_STOP UINT32_MAX
62#define GP_TIMER_DECLARE(name, texpires, tperiod, tid, tcallback, tpriv) \
64 .expires = texpires, \
67 .callback = tcallback, \
141 return queue ? queue->heap.children + 1 : 0;
static unsigned int gp_timer_queue_size(gp_timer *queue)
Returns size of the queue, i.e. number of timers.
void gp_timer_queue_dump(gp_timer *queue)
Prints the structrue of binary heap into stdout, only for debugging.
void gp_timer_queue_ins(gp_timer **queue, uint64_t now, gp_timer *timer)
Inserts timer into the timer priority queue.
void gp_timer_queue_rem(gp_timer **queue, gp_timer *timer)
Removes timer from timer queue.
static int gp_timer_running(gp_timer *timer)
Returns if timer is running.
int gp_timer_queue_process(gp_timer **queue, uint64_t now)
Processes queue, all timers with expires <= now are processed.
uint32_t(* callback)(struct gp_timer *self)
Timer callback.