|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Non-recursive blocking mutual exclusion (ADR-033). More...
Files | |
| file | src/oal/mutex/rte_mutex.c |
| Mutex service: validates parameters, then dispatches to the OSAdapter registered via rte_osadapter_mutex_register() (ADR-033). | |
Typedefs | |
| typedef struct rte_mutex_impl_s * | rte_mutex_handle_t |
Functions | |
| RTE_DECLARE_STORAGE (rte_mutex_storage_t, 128U) | |
| rte_status_t | rte_mutex_create (rte_mutex_storage_t *storage, rte_mutex_handle_t *out_handle) |
| Creates (and initializes, unlocked) a priority-inheritance mutex bound to caller-owned storage (REQ-OAL-MUTEX-004). | |
| rte_status_t | rte_mutex_lock (rte_mutex_handle_t handle) |
| Blocks the calling task until it holds the mutex. | |
| rte_status_t | rte_mutex_lock_timed (rte_mutex_handle_t handle, rte_duration_ms_t timeout_ms) |
| Waits at most timeout_ms for the mutex (OSA rule R2: every wait bounded). | |
| rte_status_t | rte_mutex_unlock (rte_mutex_handle_t handle) |
| Releases a mutex previously locked by the calling task. | |
| rte_status_t | rte_mutex_destroy (rte_mutex_handle_t handle) |
| Destroys a mutex, releasing any OSAdapter resources bound to it. Must not be called while any task holds or is waiting on the lock. | |
Non-recursive blocking mutual exclusion (ADR-033).
| typedef struct rte_mutex_impl_s* rte_mutex_handle_t |
Opaque handle bound to a rte_mutex_storage_t after rte_mutex_create().
Definition at line 47 of file rte_mutex.h.
| RTE_DECLARE_STORAGE | ( | rte_mutex_storage_t | , |
| 128U | ) |
Opaque caller-owned storage for one mutex instance. Size is part of the ABI.
| rte_status_t rte_mutex_create | ( | rte_mutex_storage_t * | storage, |
| rte_mutex_handle_t * | out_handle ) |
Creates (and initializes, unlocked) a priority-inheritance mutex bound to caller-owned storage (REQ-OAL-MUTEX-004).
| storage | Caller-owned storage the mutex's state is placed into. Must not be NULL and must outlive the mutex. |
| out_handle | Receives the created mutex's handle. Must not be NULL. |
Definition at line 44 of file rte_mutex.c.
| rte_status_t rte_mutex_lock | ( | rte_mutex_handle_t | handle | ) |
Blocks the calling task until it holds the mutex.
| handle | Mutex to lock. Must not be NULL. |
Definition at line 74 of file rte_mutex.c.
| rte_status_t rte_mutex_lock_timed | ( | rte_mutex_handle_t | handle, |
| rte_duration_ms_t | timeout_ms ) |
Waits at most timeout_ms for the mutex (OSA rule R2: every wait bounded).
Not gated by the setup-phase lock: an operational call, like rte_mutex_lock(). On RTE_STATUS_OK the calling task holds the mutex and must release it with rte_mutex_unlock(); on any other status it does not hold it.
| handle | Mutex to lock. Must not be NULL. |
| timeout_ms | Maximum time to wait for the mutex, in milliseconds. 0 is one non-blocking try (same rule as rte_ipc_send()/rte_ipc_receive()). |
Definition at line 91 of file rte_mutex.c.
| rte_status_t rte_mutex_unlock | ( | rte_mutex_handle_t | handle | ) |
Releases a mutex previously locked by the calling task.
| handle | Mutex to unlock. Must not be NULL. Unlocking a mutex the calling task does not hold is undefined behavior (same as pthread_mutex_unlock()). |
Definition at line 111 of file rte_mutex.c.
| rte_status_t rte_mutex_destroy | ( | rte_mutex_handle_t | handle | ) |
Destroys a mutex, releasing any OSAdapter resources bound to it. Must not be called while any task holds or is waiting on the lock.
| handle | Mutex to destroy. Must not be NULL. Invalid to use after this call. |
Definition at line 128 of file rte_mutex.c.