21#include "xtc_export.h"
35typedef enum xtc_restart_strategy {
36 XTC_SUP_ONE_FOR_ONE = 0,
37 XTC_SUP_ONE_FOR_ALL = 1,
38 XTC_SUP_REST_FOR_ONE = 2,
39 XTC_SUP_SIMPLE_OFO = 3
40} xtc_restart_strategy_t;
42typedef enum xtc_restart_policy {
43 XTC_RESTART_PERMANENT = 0,
44 XTC_RESTART_TRANSIENT = 1,
45 XTC_RESTART_TEMPORARY = 2
46} xtc_restart_policy_t;
53typedef struct xtc_child_spec {
57 xtc_restart_policy_t policy;
64typedef struct xtc_sup_opts {
65 xtc_restart_strategy_t strategy;
68 struct xtc_exec *exec;
80#define XTC_SUP_OPTS_DEFAULT { \
81 .strategy = XTC_SUP_ONE_FOR_ONE, \
83 .period_ns = 5LL * 1000 * 1000 * 1000, \
88typedef struct xtc_supervisor xtc_supervisor_t;
105XTC_API
int xtc_sup_start(xtc_loop_t *loop,
109 xtc_supervisor_t **out_sup);
116XTC_API
int xtc_sup_stop(xtc_supervisor_t *sup);
124XTC_API
int xtc_sup_add_child(xtc_supervisor_t *sup,
const xtc_child_spec_t *spec,
131int xtc_sup_join(xtc_supervisor_t *sup, int64_t timeout_ns);
133XTC_API
int xtc_sup_n_children(
const xtc_supervisor_t *sup);
134XTC_API
int xtc_sup_n_alive(
const xtc_supervisor_t *sup);
135XTC_API
int xtc_sup_n_restarts(
const xtc_supervisor_t *sup);
136XTC_API
int xtc_sup_alive(
const xtc_supervisor_t *sup);