[riot-notifications] [RIOT-OS/RIOT] core/schedstatistics: fix call to uninitialized xtimer (#11781)

Gaëtan Harter notifications at github.com
Mon Sep 2 17:12:34 CEST 2019


> > sched_active_thread is set to NULL when a thread is exiting and its TCB is removed. So in sched_run, there is no active thread.
> 
> Unless I'm missing something, this isn't an issue since we are using `sched_active_pid` for `sched_cb` which is changed after the callback is executed so the last usage is indeed reported (since `cpu_switch_context_exit` immediatly calls `sched_run`).

Indeed, this was also fixed by this PR to use `sched_active_pid` and report the last time from a thread. So a +1 again for using `pid` there.
I found about it in `master` and was before using `active_thread`. I did not re-checked that your handling fixed it. My bad.

It would be good to put a comment at least when you call `sched_cb` to say it relied on this.

This version is like 50 times better than the previous one.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11781#issuecomment-527180722
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190902/728cd635/attachment.htm>


More information about the notifications mailing list