Skip to content

Backport work queue builder #87

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

Open
wants to merge 2 commits into
base: v4.1-branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ manifest:
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: main
revision: pull/88345/head
import:
# By using name-allowlist we can clone only the modules that are
# strictly needed by the application.
Expand Down
14 changes: 14 additions & 0 deletions zephyr/src/work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
//! .set_priority(2).
//! .set_name(c"mainloop")
//! .set_no_yield(true)
//! .set_work_timeout_ms(1000)
//! .start(MAIN_LOOP_STACK.init_once(()).unwrap())
//! );
//!
Expand Down Expand Up @@ -220,6 +221,7 @@ impl WorkQueueBuilder {
name: ptr::null(),
no_yield: false,
essential: false,
work_timeout_ms: 0,
},
priority: 0,
}
Expand Down Expand Up @@ -255,6 +257,18 @@ impl WorkQueueBuilder {
self
}

/// Controls whether work queue monitors work timeouts.
///
/// If non-zero, and CONFIG_WORKQUEUE_WORK_TIMEOUT is enabled,
/// the work queue will monitor the duration of each work item.
/// If the work item handler takes longer than the specified
/// time to execute, the work queue thread will be aborted, and
/// an error will be logged if CONFIG_LOG is enabled.
pub fn set_work_timeout_ms(&mut self, value: u32) -> &mut Self {
self.config.work_timeout_ms = value;
self
}

/// Set the priority for the worker thread.
///
/// See the Zephyr docs for the meaning of priority.
Expand Down