Closed JordanYates closed 3 years ago
Timer callbacks are already run from the system workqueue.
That's not what the documentation says, is it? Has that changed since last year?
The function could probably be changed to use a delayable work item instead of the timer and regular work item.
Hmm, it doesn't look like it has changed, and I can't remember the context of this from last year. It could have just been confusion around why bother deferring the reboot to the workqueue thread.
The zephyr implementation of
os_mgmt_impl_reset
triggers a timer to defer the reset by a small time duration. The timer expiry function then submits a workqueue item so that the reset is run from the system workqueue.Timer callbacks are already run from the system workqueue. https://docs.zephyrproject.org/latest/reference/kernel/timing/timers.html#using-a-timer-expiry-function)
The additional workqueue item can therefore be removed, with
sys_reboot
being called directly from the timer expiry function.