|
Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Process-wide INIT/RUN boundary enforcement (ADR-026). More...
Files | |
| file | src/utils/lifecycle/sapi_lifecycle.c |
| Implementation of the process-wide application setup-phase lock - see sapi_lifecycle.h. | |
Functions | |
| void | sapi_lifecycle_lock (void) |
| Locks the application's setup phase. | |
| void | sapi_lifecycle_unlock (void) |
| Unlocks the application's setup phase (setup is allowed again). | |
| bool | sapi_lifecycle_is_locked (void) |
| sapi_status_t | sapi_lifecycle_check_setup_allowed (void) |
| Convenience check for a setup-only constructor: call this as one of the first checks in any function that creates/registers a new long-lived resource (a timer, channel, voter, cross-comparator, or watchdog - see this file's own header for the excluded netlink/dual exceptions). | |
Process-wide INIT/RUN boundary enforcement (ADR-026).
| void sapi_lifecycle_lock | ( | void | ) |
Locks the application's setup phase.
After this call, sapi_lifecycle_check_setup_allowed() (and therefore every setup-only constructor that calls it) returns SAPI_STATUS_INVALID_STATE until the next sapi_lifecycle_unlock(). Idempotent: locking an already-locked application is a no-op.
Intended caller: sapi_appmanager_run(), immediately after ops->init() returns SAPI_STATUS_OK - integrator application code does not call this directly under normal use.
Global variables declarations Local function declarations Global functions
Definition at line 25 of file sapi_lifecycle.c.
| void sapi_lifecycle_unlock | ( | void | ) |
Unlocks the application's setup phase (setup is allowed again).
Idempotent: unlocking an already-unlocked application is a no-op.
Intended caller: sapi_appmanager_run(), at the start of every call - this is what lets this framework's own test suite (and any integrator code) call sapi_appmanager_run() more than once, sequentially, in one process and have each call's own setup phase behave independently.
Definition at line 30 of file sapi_lifecycle.c.
| bool sapi_lifecycle_is_locked | ( | void | ) |
Definition at line 35 of file sapi_lifecycle.c.
| sapi_status_t sapi_lifecycle_check_setup_allowed | ( | void | ) |
Convenience check for a setup-only constructor: call this as one of the first checks in any function that creates/registers a new long-lived resource (a timer, channel, voter, cross-comparator, or watchdog - see this file's own header for the excluded netlink/dual exceptions).
Definition at line 40 of file sapi_lifecycle.c.