Skip to content

Align WorkQueueBuilder with new workqueue work timeout feature #86

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 3 commits into
base: main
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
4 changes: 1 addition & 3 deletions samples/blinky/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ common:
- qemu_riscv64
- nrf52840dk/nrf52840
tests:
sample.basic.blinky:
sample.rust.basic.blinky:
tags:
- LED
- gpio
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds")
depends_on: gpio
harness: led
integration_platforms:
- frdm_k64f
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
Loading