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

#include "util/thread/thread.h"

#include "loop.h"

struct nn_timer {
    ev_timer timer;
    struct nn_event_loop *loop;
    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_stop(struct nn_timer *timer);