[riot-commits] [RIOT-OS/RIOT] 88b509: ztimer: correctly unset timer->next (fix ztimer_is...

Hauke Petersen noreply at github.com
Thu Apr 22 12:07:03 CEST 2021


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 88b509e56de7df84a636382625ada466b78ecd4c
      https://github.com/RIOT-OS/RIOT/commit/88b509e56de7df84a636382625ada466b78ecd4c
  Author: Kaspar Schleiser <kaspar at schleiser.de>
  Date:   2021-04-22 (Thu, 22 Apr 2021)

  Changed paths:
    M sys/ztimer/core.c

  Log Message:
  -----------
  ztimer: correctly unset timer->next (fix ztimer_is_set())

ztimer's machinery depends on figuring out if a timer is currently set
or not. It does that using _is_set(), which is also exposed as
ztimer_is_set().
Now when a timer expired and got taken of the timer queue using
_now_next(), the `next` pointer wasn't unset. This caused _is_set() to
wrongly return `true` for that timer.
Internally in ztimer, this didn't cause breakage, just an unnecessary
iteration of the timer queue by _delete_timer_from_list().
But this also broke the public ztimer_is_set().

This commit fixes the issue by correctly NULLing the timer's `next`
pointer when the timer triggers.


  Commit: 20981e5f7cf494257d1941d505977cb489650c2e
      https://github.com/RIOT-OS/RIOT/commit/20981e5f7cf494257d1941d505977cb489650c2e
  Author: Kaspar Schleiser <kaspar at schleiser.de>
  Date:   2021-04-22 (Thu, 22 Apr 2021)

  Changed paths:
    M tests/unittests/tests-ztimer/tests-ztimer-mock.c

  Log Message:
  -----------
  tests/unittests: tests-ztimer: add ztimer_is_set() regression test


  Commit: a7a3244b8f9fe5796fe5247d543b999fd7b560c5
      https://github.com/RIOT-OS/RIOT/commit/a7a3244b8f9fe5796fe5247d543b999fd7b560c5
  Author: Hauke Petersen <hauke.petersen at fu-berlin.de>
  Date:   2021-04-22 (Thu, 22 Apr 2021)

  Changed paths:
    M sys/ztimer/core.c
    M tests/unittests/tests-ztimer/tests-ztimer-mock.c

  Log Message:
  -----------
  Merge pull request #16367 from kaspar030/fix_ztimer_is_set

ztimer: fix `ztimer_is_set()`


Compare: https://github.com/RIOT-OS/RIOT/compare/81feb3c3c407...a7a3244b8f9f


More information about the commits mailing list