summaryrefslogtreecommitdiff
path: root/timer.c
blob: 0c891368f8e038dcec0509e45c46efa420fe21e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*-*- Mode: C; c-basic-offset: 8 -*-*/

#include "name.h"
#include "timer.h"

static void timer_done(Name *n) {
        Timer *t = TIMER(n);

        assert(t);
}

static NameActiveState timer_active_state(Name *n) {

        static const NameActiveState table[_TIMER_STATE_MAX] = {
                [TIMER_DEAD] = NAME_INACTIVE,
                [TIMER_WAITING] = NAME_ACTIVE,
                [TIMER_RUNNING] = NAME_ACTIVE
        };

        return table[TIMER(n)->state];
}

const NameVTable timer_vtable = {
        .suffix = ".timer",

        .init = name_load_fragment_and_dropin,
        .done = timer_done,

        .active_state = timer_active_state
};