[Olsr-dev] Questions then
Ferry Huberts
(spam-protected)
Sat Feb 24 22:26:55 CET 2018
the scheduler can't handle timers being removed while iterating over
them. this caused all kinds of nastyness a while ago and I cleaned that
up. now the scheduler iterates over all running (not-tagged for removal)
timers, and after iterating, all timers that are tagged for removal are
actually removed. IIRC.
On 24/02/18 19:42, Henning Rogge wrote:
> Hi,
>
> the flags were most likely introduced at totally different times... if
> I remember it correctly the "removed" flag is there to allow a timer
> callback to stop/remove multiple other timers without the scheduler
> loop going crazy because of a lost context.
>
> As you can see with the OONF codebase, this could most likely be
> cleaned up in OLSR too.
>
> Henning Rogge
>
> On Fri, Feb 23, 2018 at 2:59 PM, Kees-Jan Hermans <(spam-protected)> wrote:
>> 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)
>> +31 6 41454384
>>
>>
>> --
>> Olsr-dev mailing list
>> (spam-protected)
>> https://lists.olsr.org/mailman/listinfo/olsr-dev
>
--
Ferry Huberts
More information about the Olsr-dev
mailing list