Expand description
RTEMS-side background-execution infrastructure (CA sans-io refactor, increment W3a — the seam backend).
§Why this exists (decision A2)
The CA server is being made runnable on RTEMS (armv7-rtems-eabihf) with
one async engine. On a hosted target, async tails — PACT device
completion, FLNK/scanOnce chains, SDLY/ODLY/watchdog timers, WRITE_NOTIFY
completion — run as tokio tasks via crate::runtime::task::spawn. RTEMS
has no tokio runtime (tokio::spawn/tokio::time need one), so those tails
need a runtime-free home. This module is that home: three C-parity
facilities built from plain std threads + Mutex/Condvar, carrying
no tokio dependency.
| Facility | C source | Rust |
|---|---|---|
callback_executor | callback.c callbackQueue[]/callbackTask | priority-banded worker pool |
delayed_timer | callback.c callbackRequestDelayed/timerQueue | one deadline-ordered timer thread |
scan_once | dbScan.c onceQ/scanOnce/onceTask | bounded ring + one worker |
§The seam handle
BackgroundExecutor owns the three facilities and their threads;
BackgroundExecutor::handle hands out a cheap, clonable
BackgroundHandle that the future seam wiring routes synchronous-tail
hand-offs through. The hosted (tokio) build keeps calling
crate::runtime::task::spawn — this module is only the RTEMS route,
and this increment adds the infrastructure without switching any call site
over to it (that is a later increment).
Re-exports§
pub use callback_executor::Callback;pub use callback_executor::CallbackError;pub use callback_executor::CallbackHandle;pub use callback_executor::CallbackPool;pub use callback_executor::CallbackPriority;pub use callback_executor::DEFAULT_QUEUE_SIZE;pub use callback_executor::DEFAULT_THREADS_PER_PRIORITY;pub use callback_executor::NUM_CALLBACK_PRIORITIES;pub use delayed_timer::DelayedTimer;pub use delayed_timer::TimerHandle;pub use future_exec::AbortHandle;pub use future_exec::DEFAULT_SPAWN_PRIORITY;pub use future_exec::JoinError;pub use future_exec::JoinFuture;pub use future_exec::spawn_blocking_on;pub use future_exec::spawn_future;pub use scan_once::DEFAULT_ONCE_QUEUE_SIZE;pub use scan_once::OnceCallback;pub use scan_once::ScanOnceHandle;pub use scan_once::ScanOnceOverflow;pub use scan_once::ScanOnceQueue;
Modules§
- callback_
executor - General-purpose callback executor pool — RTEMS-safe port of
modules/database/src/ioc/db/callback.c. - delayed_
timer - Delayed-callback timer facility — RTEMS-safe port of
callbackRequestDelayedand itsepicsTimerQueueusage inmodules/database/src/ioc/db/callback.c. - facility
- What keeps a facility thread alive, and what is said when one dies.
- future_
exec - Runtime-free future executor over the callback pool — the RTEMS backend for
crate::runtime::task::spawn/crate::runtime::task::spawn_blocking(decision A2, increment W3b). - scan_
once scanOncequeue + worker — RTEMS-safe port of theonceQ/scanOnce/onceTaskmachinery inmodules/database/src/ioc/db/dbScan.c.- timer_
sleep - Timer-backed
sleep/sleep_untilfutures — the RTEMS backend forcrate::runtime::task::sleep/crate::runtime::task::sleep_until(decision A2, increment W3b item 4).
Structs§
- Background
Executor - Owns the three background facilities (callback pool, delayed timer, scanOnce worker) and every thread backing them. Constructing it starts the threads; dropping it stops and joins them.
- Background
Handle - Cheap, clonable submission side of a
BackgroundExecutor. Every method enqueues and returns immediately; the work runs on a background thread.