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

Kaspar Schleiser noreply at github.com
Thu Apr 22 13:02:56 CEST 2021


  Branch: refs/heads/2021.04-branch
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 3811dd817070f6e3b0236e66df0e1cbd38478909
      https://github.com/RIOT-OS/RIOT/commit/3811dd817070f6e3b0236e66df0e1cbd38478909
  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.

(cherry picked from commit 88b509e56de7df84a636382625ada466b78ecd4c)


  Commit: e543b37eb41339928bc209482957c216fee7a53e
      https://github.com/RIOT-OS/RIOT/commit/e543b37eb41339928bc209482957c216fee7a53e
  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

(cherry picked from commit 20981e5f7cf494257d1941d505977cb489650c2e)


  Commit: e42ef1924f4bbd691662832a5a44c4c6cfe2d1f7
      https://github.com/RIOT-OS/RIOT/commit/e42ef1924f4bbd691662832a5a44c4c6cfe2d1f7
  Author: Kaspar Schleiser <kaspar at schleiser.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 #16368 from kaspar030/backport/2021.04/fix_ztimer_is_set

ztimer: fix `ztimer_is_set()` [backport 2021.04]


Compare: https://github.com/RIOT-OS/RIOT/compare/168864b8a1d0...e42ef1924f4b


More information about the commits mailing list