reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
watchdog.c File Reference

Definitions for watchdogs. More...

#include <assert.h>
#include "watchdog.h"
#include "environment.h"
#include "util.h"
#include "clock.h"

Functions

void _lf_initialize_watchdogs (environment_t *env)
 Initialize watchdog mutexes. For any reactor with one or more watchdogs, the self struct should have a non-NULL reactor_mutex field which points to an instance of lf_mutex_t. This function initializes those mutexes. It also initializes the condition variable which enables the safe termination of a running watchdog. Finally it starts of a non-termminating thread for each watchdog.
 
void _lf_watchdog_terminate_all (environment_t *env)
 Terminate all watchdog threads.
 
void watchdog_wait (watchdog_t *watchdog)
 
void lf_watchdog_start (watchdog_t *watchdog, interval_t additional_timeout)
 Start or restart the watchdog timer.
 
void lf_watchdog_stop (watchdog_t *watchdog)
 Stop the specified watchdog without invoking the expiration handler. This function sets the expiration time of the watchdog to NEVER.
 

Detailed Description

Definitions for watchdogs.

Author
Benjamin Asch
Edward A. Lee
Erling Jellum

Function Documentation

◆ _lf_initialize_watchdogs()

void _lf_initialize_watchdogs ( environment_t * env)

Initialize watchdog mutexes. For any reactor with one or more watchdogs, the self struct should have a non-NULL reactor_mutex field which points to an instance of lf_mutex_t. This function initializes those mutexes. It also initializes the condition variable which enables the safe termination of a running watchdog. Finally it starts of a non-termminating thread for each watchdog.

◆ _lf_watchdog_terminate_all()

void _lf_watchdog_terminate_all ( environment_t * env)

Terminate all watchdog threads.

◆ lf_watchdog_start()

void lf_watchdog_start ( watchdog_t * watchdog,
interval_t additional_timeout )

Start or restart the watchdog timer.

This function sets the expiration time of the watchdog to the current logical time plus the minimum timeout of the watchdog plus the specified additional_timeout. This function assumes the reactor mutex is held when it is called; this assumption is satisfied whenever this function is called from within a reaction that declares the watchdog as an effect.

Parameters
watchdogThe watchdog to be started
additional_timeoutAdditional timeout to be added to the watchdog's minimum expiration.

◆ lf_watchdog_stop()

void lf_watchdog_stop ( watchdog_t * watchdog)

Stop the specified watchdog without invoking the expiration handler. This function sets the expiration time of the watchdog to NEVER.

Parameters
watchdogThe watchdog.

◆ watchdog_wait()

void watchdog_wait ( watchdog_t * watchdog)