Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Toggle main menu visibility
Loading...
Searching...
No Matches
sapi_mutex.h
Go to the documentation of this file.
1
30
#ifndef SAFEAPI_OS_MUTEX_H
31
#define SAFEAPI_OS_MUTEX_H
32
33
#include "
safeapi/utils/status/sapi_status.h
"
34
#include "
safeapi/utils/types/sapi_types.h
"
35
36
#ifdef __cplusplus
37
extern
"C"
{
38
#endif
39
41
SAFEAPI_DECLARE_STORAGE
(sapi_mutex_storage_t, 128U);
42
44
typedef
struct
sapi_mutex_impl_s *
sapi_mutex_handle_t
;
45
61
sapi_status_t
sapi_mutex_create
(sapi_mutex_storage_t *storage,
sapi_mutex_handle_t
*out_handle);
62
72
sapi_status_t
sapi_mutex_lock
(
sapi_mutex_handle_t
handle);
73
82
sapi_status_t
sapi_mutex_unlock
(
sapi_mutex_handle_t
handle);
83
91
sapi_status_t
sapi_mutex_destroy
(
sapi_mutex_handle_t
handle);
92
93
/*
94
* The backend vtable (sapi_mutex_backend_t) and sapi_mutex_register_backend()
95
* live in safeapi_backend/mutex/sapi_mutex_backend.h, not here (ADR-021
96
* consumer/backend split). This header is the consumer-facing surface
97
* only - a real application never needs to see the backend vtable shape;
98
* only the platform integrator wiring a concrete backend does.
99
*/
100
101
#ifdef __cplusplus
102
}
103
#endif
104
105
#endif
/* SAFEAPI_OS_MUTEX_H */
106
/* MUTEX */
sapi_mutex_handle_t
struct sapi_mutex_impl_s * sapi_mutex_handle_t
Definition
sapi_mutex.h:44
sapi_mutex_destroy
sapi_status_t sapi_mutex_destroy(sapi_mutex_handle_t handle)
Destroys a mutex, releasing any backend resources bound to it. Must not be called while any task hold...
Definition
sapi_mutex.c:108
sapi_mutex_unlock
sapi_status_t sapi_mutex_unlock(sapi_mutex_handle_t handle)
Releases a mutex previously locked by the calling task.
Definition
sapi_mutex.c:91
sapi_mutex_create
sapi_status_t sapi_mutex_create(sapi_mutex_storage_t *storage, sapi_mutex_handle_t *out_handle)
Creates (and initializes, unlocked) a mutex bound to caller-owned storage.
Definition
sapi_mutex.c:44
sapi_mutex_lock
sapi_status_t sapi_mutex_lock(sapi_mutex_handle_t handle)
Blocks the calling task until it holds the mutex.
Definition
sapi_mutex.c:74
sapi_status_t
sapi_status_t
Common result/status codes.
Definition
sapi_status.h:27
SAFEAPI_DECLARE_STORAGE
#define SAFEAPI_DECLARE_STORAGE(type_name, byte_size)
Declares an opaque, fixed-size, aligned storage type for a service's handle. The real internal layout...
Definition
sapi_types.h:69
sapi_status.h
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
sapi_types.h
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
include
safeapi
oal
mutex
sapi_mutex.h
Generated by
1.18.0