KRN-WQ requirements¶
Work items shall be intrusive and statically allocatable; submission shall be ISR-safe and O(1). Rationale: A bottom half is submitted from interrupts; it must cost one push and one bit set. Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §4.3 |
Work executes in FIFO order per queue in thread context. Rationale: Deterministic order; handlers may use thread-only API. Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §4.3 |
Delayed work shall be implemented over software timers, not a separate timing mechanism. Rationale: One timeout structure (ADR-010); one set of accuracy rules. Status: Accepted 2026-10-07 Verification: Analysis: Trace: SPEC-006 §4.1, §4.3; SPEC-003 §7 |
Cancellation shall report whether the item was pending, running, or idle. Rationale: The caller must know whether a handler may still run. Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §4.3 |
Submitting a queued item shall return Rationale: Idempotent submission without lost re-submissions and without handler re-entrancy (Zephyr’s v2 rule, R-001 §6). Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §4.3, §12.5 |
Rationale: Teardown needs a point after which no handler touches the caller’s state. Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §4.3, §6 |
Rationale: One queue hop per delayed item; deterministic re-arm semantics. Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §4.3, §12.6, §12.7 |
With Rationale: Timer callbacks need a thread; the tiny profile cannot afford one by default. Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §4.3, §8; SPEC-003 §7.3; ADR-019 |
A work queue’s thread shall wait on the Rationale: Fixes the implementation shape so that latency is the thread’s dispatch latency plus the handlers ahead. Status: Accepted 2026-10-07 Verification: Analysis: Trace: SPEC-006 §4.1, §4.3, §4.4 |
Destroying a queue with queued or running items, flushing or synchronously cancelling from the queue’s own thread, and returning from a handler while owning a mutex shall be misuse per SPEC-001 §5.3. Rationale: Each would leave work or locks in an undefined owner. Status: Accepted 2026-10-07 Verification: Test: Trace: SPEC-006 §6 |
Submit, start with submit-to-start latency, end with duration, cancel, and delayed scheduling shall be trace events; maximum FIFO length, worst latency, and longest handler with its address shall be optional statistics per queue. Rationale: Work queue latency is the latency of every timer callback and bottom half. Status: Accepted 2026-10-07 Verification: Test: trace decoder; statistics API test. Trace: SPEC-006 §7; OBS-005 |