libosmocore 0.3.6
Osmocom core library
osmo_timer_list Struct Reference

A structure representing a single instance of a timer. More...

#include <timer.h>

Data Fields

struct llist_head entry
 linked list header
struct timeval timeout
 expiration time
unsigned int active: 1
 is it active?
unsigned int handled: 1
 did we already handle it
unsigned int in_list: 1
 is it in the global list?
void(* cb )(void *)
 call-back called at timeout
void * data
 user data for callback

Detailed Description

A structure representing a single instance of a timer.

Timer management:

  • Create a struct osmo_timer_list
  • Fill out timeout and use add_timer or use schedule_timer to schedule a timer in x seconds and microseconds from now...
  • Use del_timer to remove the timer

Internally:

  • We hook into select.c to give a timeval of the nearest timer. On already passed timers we give it a 0 to immediately fire after the select
  • update_timers will call the callbacks and remove the timers.

The documentation for this struct was generated from the following file: