[Olsr-dev] Questions then

Kees-Jan Hermans (spam-protected)
Fri Feb 23 14:59:41 CET 2018


In src/scheduler.h, at line 95, I find:

/* Timer flags */
#define OLSR_TIMER_RUNNING  ( 1u << 0)   /* this timer is running */
#define OLSR_TIMER_REMOVED  ( 1u << 1)   /* this timer is tagged for removal */

which makes me wonder - is there a stage in between running and removed? Are there ’sleeping’ timers? What does it mean when a timer doesn’t have either flag set? This brings me to src/scheduler.c, at line 708:

        /* This timer is expired, call into the provided callback function */
        timer->timer_cb(timer->timer_cb_context);

        /* Only act on actually running timers */
        if (timer->timer_flags & OLSR_TIMER_RUNNING) {

Shouldn’t the calling of the timer callback only be done when the timer has actual running status? In line 954 of the same file:

  /* It's okay to get a NULL here */
  if (!timer //
      || !(timer->timer_flags & OLSR_TIMER_RUNNING)) {
    return;
  }

My question: shouldn’t the sense of the condition be inversed to mean ‘is to be removed’ rather than ‘is not running’? This could well be because I don’t quite understand the difference between the two flags.

Thanks in advance for your answers.

m. vr. gr.  / Sincerely,

KJ Hermans
Marketeer High Assurance Products at Fox Crypto BV, Netherlands
(spam-protected) <mailto:(spam-protected)>
+31 6 41454384

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20180223/f80b9bd8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20180223/f80b9bd8/attachment.sig>


More information about the Olsr-dev mailing list