-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
samples: mesh_badge: conversion of k_work API #34299
samples: mesh_badge: conversion of k_work API #34299
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving based on the expectation this has been tested; AFAICT it's unchanged from the rote conversion patch.
I think several of the calls could use schedule
instead of reschedule
, which would preserve deadlines better. With reschedule
there's theoretically a potential for livelock: the trigger event occurs fast enough that the work is never executed. But that's not new behavior, just not taking advantage of new capabilities.
k_delayed_work_init(&motion_work, motion_timeout); | ||
k_delayed_work_submit(&motion_work, MOTION_TIMEOUT); | ||
k_work_init_delayable(&motion_work, motion_timeout); | ||
k_work_reschedule(&motion_work, MOTION_TIMEOUT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be k_work_schedule()
since there is no earlier timeout that might need to be overridden.
@@ -93,7 +93,7 @@ static void motion_timeout(struct k_work *work) | |||
printk("power save\n"); | |||
|
|||
if (!mesh_is_initialized()) { | |||
k_delayed_work_submit(&motion_work, MOTION_TIMEOUT); | |||
k_work_reschedule(&motion_work, MOTION_TIMEOUT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this too could be k_work_schedule()
, in case a motion event was detected after the work was queued but before the work thread got to it.
Replace all existing deprecated API with the recommended alternative. Be aware that this does not address architectural errors in the use of the work API. Fixes zephyrproject-rtos#34097 Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no> Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
4a55d40
to
8b763dd
Compare
Replace all existing deprecated API with the recommended alternative.
Fixes #34097