-
Notifications
You must be signed in to change notification settings - Fork 1
Timed Tenants #329
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
base: main
Are you sure you want to change the base?
Timed Tenants #329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for "Timed Tenants" - tenants designed to run periodically without the overhead of using a traditional task. The implementation provides a timer-based execution mechanism for tenant classes.
- Introduces a new
CTimedTenantclass that extendsCTenantwith timer-based periodic execution - Adds a new constructor to
CSoftTimerthat automatically starts the timer upon initialization - Updates the build system to include tenant source files in the compilation
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/f_core/os/tenants/c_timed_tenant.cpp |
Implementation of the timed tenant class with timer callback functionality |
lib/f_core/os/CMakeLists.txt |
Updates build configuration to include tenant source files |
include/f_core/utils/c_soft_timer.h |
Adds constructor that auto-starts timer with specified timeout |
include/f_core/os/tenants/c_timed_tenant.h |
Header file defining the timed tenant interface |
app/backplane/sensor_module/src/c_sensor_module.cpp |
Adds include for the new timed tenant header |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an abstraction point of view, does this deserve the name tenant?
Before now, tenants were things that were on tasks and managed by StartRTOS/StopRTOS
As far as I can tell, the timed 'tenant' is not run on a task nor is it started/stopped by Start/StopRTOS just by the constructor
Also, I believe the idea of the timer expiry function is that it is 'interrupt-esque' if not fully in an interrupt context

https://docs.zephyrproject.org/latest/kernel/services/timing/timers.html#using-a-timer-expiry-function
To me, Calling this a tenant and having the Run method on it disguises this limitation since all other Run's are not required to be interrupt safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk what the correct place to go from here is tbh,
- Just documenting the limitation seems dangerous bc its really easy to not read documentatino and now our beautiful little abstraction isnt so conceptually solid bc some tenants arent tenatns
- Idk the exact workings of this but if the timer just signalled to the task thats running the TimedTenant that would solve this, but, that kinda defeats the point of the timed scheduling that this was supposed to handle bc you're on a timer but still beholden to the loop on the task that runs its tenants and the delays between the runs
I think this needs a little more considering before it goes in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair this was like a 15 minute thing to write
This closes #328
Description
Adds support for tenants designed to be run periodically, but without the overhead of using a task.
Type of change
How Has This Been Tested?
Testing with CpuMonitorTenant changes
Checklist: