reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
watchdog.h
Go to the documentation of this file.
1
10#ifndef WATCHDOG_H
11#define WATCHDOG_H 1
12
13#include "lf_types.h"
14#include "environment.h"
15#include "platform.h" // For lf_thread_t.
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
26typedef void (*watchdog_function_t)(void*);
27
29typedef struct watchdog_t {
30 struct self_base_t* base; // The reactor that contains the watchdog.
31 trigger_t* trigger; // The trigger associated with this watchdog.
32 instant_t expiration; // The expiration instant for the watchdog. (Initialized to NEVER)
33 interval_t min_expiration; // The minimum expiration interval for the watchdog.
34 lf_thread_t thread_id; // The thread that the watchdog is meant to run on.
35 lf_cond_t cond; // Condition variable used for sleeping and termination.
36 bool active; // Boolean indicating whether or not thread is active.
37 bool terminate; // Boolean indicating whether termination of the thread has been requested.
38 watchdog_function_t watchdog_function; // The function/handler for the watchdog.
40
54void lf_watchdog_start(watchdog_t* watchdog, interval_t additional_timeout);
55
62void lf_watchdog_stop(watchdog_t* watchdog);
63
65// The following functions are internal to the runtime and should not be documented by Doxygen.
67
72
75
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif
API for the environment data structure.
void * lf_thread_t
Definition lf_arduino_support.h:120
Type definitions that are widely used across different parts of the runtime.
Platform API for runtime plugins to use while sharing implementation source code and binaries with th...
Execution environment. This struct contains information about the execution environment....
Definition environment.h:49
Definition lf_POSIX_threads_support.h:41
The base type for all reactor self structs.
Definition lf_types.h:276
Definition lf_types.h:208
Definition watchdog.h:29
struct self_base_t * base
Definition watchdog.h:30
watchdog_function_t watchdog_function
Definition watchdog.h:38
lf_cond_t cond
Definition watchdog.h:35
bool active
Definition watchdog.h:36
lf_thread_t thread_id
Definition watchdog.h:34
instant_t expiration
Definition watchdog.h:32
interval_t min_expiration
Definition watchdog.h:33
trigger_t * trigger
Definition watchdog.h:31
bool terminate
Definition watchdog.h:37
int64_t instant_t
Definition tag.h:63
int64_t interval_t
Definition tag.h:68
void _lf_initialize_watchdogs(environment_t *env)
Initialize watchdog mutexes. For any reactor with one or more watchdogs, the self struct should have ...
Definition watchdog.c:29
void _lf_watchdog_terminate_all(environment_t *env)
Terminate all watchdog threads.
Definition watchdog.c:45
void(* watchdog_function_t)(void *)
Definition watchdog.h:26
void lf_watchdog_start(watchdog_t *watchdog, interval_t additional_timeout)
Start or restart the watchdog timer.
Definition watchdog.c:142
void lf_watchdog_stop(watchdog_t *watchdog)
Stop the specified watchdog without invoking the expiration handler. This function sets the expiratio...
Definition watchdog.c:154
struct watchdog_t watchdog_t