summaryrefslogtreecommitdiff
path: root/src/timer.h
blob: 15b467f86dc6fa6bc49c095967b4e672508b1034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include "util/thread/thread.h"

#include "loop.h"

struct nn_timer {
    ev_timer timer;
    struct nn_event_loop *loop;
    bool disabled;
    void (*callback)(void *, struct nn_timer *);
    void *userdata;
};

void nn_timer_init(struct nn_timer *timer, struct nn_event_loop *loop,
    void (*callback)(void *, struct nn_timer *), void *userdata);
void nn_timer_set_repeat(struct nn_timer *timer, nn_os_tstamp repeat);
void nn_timer_again(struct nn_timer *timer);
void nn_timer_disable(struct nn_timer *timer);
void nn_timer_enable(struct nn_timer *timer);
void nn_timer_stop(struct nn_timer *timer);