[Olsr-dev] Development tips on timers

Hannes Gredler (spam-protected)
Thu Jun 11 23:00:11 CEST 2009

On Thu, Jun 11, 2009 at 05:56:07PM +0200, ZioPRoTo (Saverio Proto) wrote:
| Hello,
| I'm working on the implementation of the OLSR OBAMP plugin.
| (Yes, finally I decided to implement OBAMP as a OLSR plugin, and not
| as a protocol independent stuff. There are several motivations for
| this choice, but this is a different topic)
| I want to avoid libpthread because I know that they are very bad when
| using olsrd with ulibc.
| So, instead of having different threads with while(1) loops ... what
| should I do ?
| Should I use the struct timer_entry (from scheduler.h) and create a
| callback to each of my functions, to call them every second for
| example ?

certainly - just create a periodic timer and supply a callback function which
gets executed every time the timer fires. there are many examples
in the code - just look for olsr_start_timer().

| For example to generate an OBAMP hello message every 5 second can I
| use a timer_entry like it is done for the MID messages ??

yes, thats the intend :-)
| Any good documentation to go to see other than scheduler.h ?

the interface code (unix/ifnet.c) is a good example.
- here you see periodic message generation for Hellos, MIDs, HNAs and TCs.

More information about the Olsr-dev mailing list