Skip to content

Commit 10be7f8

Browse files
work: update to include new workq config param
The k_work_q has been extended with a new feature, the work timeout, which comes with a new field to k_work_queue_config, work_timeout_ms, which must be initialized. This commit adds the parameter to the WorkQueueBuilder builder. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 8952b44 commit 10be7f8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ci-manifest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ manifest:
1212
projects:
1313
- name: zephyr
1414
remote: zephyrproject-rtos
15-
revision: main
15+
revision: pull/88345/head
1616
import:
1717
# By using name-allowlist we can clone only the modules that are
1818
# strictly needed by the application.

zephyr/src/work.rs

+14
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
//! .set_priority(2).
139139
//! .set_name(c"mainloop")
140140
//! .set_no_yield(true)
141+
//! .set_work_timeout_ms(1000)
141142
//! .start(MAIN_LOOP_STACK.init_once(()).unwrap())
142143
//! );
143144
//!
@@ -225,6 +226,7 @@ impl WorkQueueBuilder {
225226
name: ptr::null(),
226227
no_yield: false,
227228
essential: false,
229+
work_timeout_ms: 0,
228230
},
229231
priority: 0,
230232
}
@@ -260,6 +262,18 @@ impl WorkQueueBuilder {
260262
self
261263
}
262264

265+
/// Controls whether work queue monitors work timeouts.
266+
///
267+
/// If non-zero, and CONFIG_WORKQUEUE_WORK_TIMEOUT is enabled,
268+
/// the work queue will monitor the duration of each work item.
269+
/// If the work item handler takes longer than the specified
270+
/// time to execute, the work queue thread will be aborted, and
271+
/// an error will be logged if CONFIG_LOG is enabled.
272+
pub fn set_work_timeout_ms(&mut self, value: u32) -> &mut Self {
273+
self.config.work_timeout_ms = value;
274+
self
275+
}
276+
263277
/// Set the priority for the worker thread.
264278
///
265279
/// See the Zephyr docs for the meaning of priority.

0 commit comments

Comments
 (0)