summaryrefslogtreecommitdiff
path: root/minecproxy/ptimer.h
blob: 3d6afd4cb13547f6e93c5fa9a8567c8687fb484c (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
31
32
33
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef fooptimerhfoo
#define fooptimerhfoo

struct ptimer_task {
	unsigned interval;
	unsigned times;
	void (*cb)(struct ptimer_task *);
	bool active;
	unsigned remain;
	struct list_head list;
};

static inline void ptask_init(struct ptimer_task *ptask, unsigned interval,
			      unsigned times, void (*cb)(struct ptimer_task *))
{
	ptask->interval = interval;
	ptask->times = times;
	ptask->cb = cb;
	ptask->active = false;
}

void ptimer_del_task(struct ptimer_task *ptask);

void ptimer_add_task(struct ptimer_task *ptask);

void ptimer_refdump();

void ptimer_delete();

void ptimer_init();

#endif