|
SafeAPI Backend POSIX
POSIX/Linux OAL backend for safeAPIFreamwork
|
POSIX sapi_timer backend: one pthread per timer, sleeping via a relative, EINTR-restartable nanosleep() (ADR-018 section 2.3). More...
#include "safeapi/posix_backend/sapi_posix_backend.h"#include <errno.h>#include <pthread.h>#include <signal.h>#include "safeapi/oal/memory/sapi_mem_util.h"#include <time.h>Go to the source code of this file.
Data Structures | |
| struct | posix_timer_state_t |
Macros | |
| #define | _POSIX_C_SOURCE 200809L |
Typedefs | |
| typedef char | posix_timer_storage_fits_[(sizeof(posix_timer_state_t)<=sizeof(sapi_timer_storage_t)) ? 1 :-1] |
Functions | |
| static void | ms_to_timespec (sapi_duration_ms_t ms, struct timespec *out_ts) |
| static void * | timer_thread_main (void *arg) |
| static sapi_status_t | backend_create (sapi_timer_storage_t *storage, const sapi_timer_config_t *config, sapi_timer_handle_t *out_handle) |
| static sapi_status_t | backend_stop (sapi_timer_handle_t handle) |
| static sapi_status_t | backend_start (sapi_timer_handle_t handle) |
| static sapi_status_t | backend_destroy (sapi_timer_handle_t handle) |
| static sapi_status_t | backend_now (sapi_timestamp_ms_t *out_now_ms) |
| const sapi_timer_backend_t * | sapi_posix_backend_timer (void) |
| The POSIX sapi_timer backend (one pthread per timer). | |
Variables | |
| static const sapi_timer_backend_t | s_posix_timer_backend |
POSIX sapi_timer backend: one pthread per timer, sleeping via a relative, EINTR-restartable nanosleep() (ADR-018 section 2.3).
Deliberately uses nanosleep() rather than clock_nanosleep(CLOCK_MONOTONIC, ...): the latter is a Linux/glibc extension not implemented by Darwin's libc (macOS has no clock_nanosleep at all), and this backend targets any POSIX host, not Linux specifically. Each period is slept as a fresh relative duration (not measured against an absolute deadline), so a concurrent system clock adjustment is not compensated for here - stated as a known simplification, matching this file's other documented trade-offs.
Definition in file sapi_posix_backend_timer.c.
| #define _POSIX_C_SOURCE 200809L |
Definition at line 1 of file sapi_posix_backend_timer.c.
| typedef char posix_timer_storage_fits_[(sizeof(posix_timer_state_t)<=sizeof(sapi_timer_storage_t)) ? 1 :-1] |
Definition at line 40 of file sapi_posix_backend_timer.c.
|
static |
Definition at line 143 of file sapi_posix_backend_timer.c.
|
static |
Definition at line 206 of file sapi_posix_backend_timer.c.
|
static |
Definition at line 211 of file sapi_posix_backend_timer.c.
|
static |
Definition at line 179 of file sapi_posix_backend_timer.c.
|
static |
Definition at line 162 of file sapi_posix_backend_timer.c.
|
static |
Local function declarations
Definition at line 71 of file sapi_posix_backend_timer.c.
| const sapi_timer_backend_t * sapi_posix_backend_timer | ( | void | ) |
The POSIX sapi_timer backend (one pthread per timer).
Global variables declarations Global functions
Definition at line 62 of file sapi_posix_backend_timer.c.
|
static |
Definition at line 91 of file sapi_posix_backend_timer.c.
|
static |
Local variables declarations
Definition at line 55 of file sapi_posix_backend_timer.c.