summaryrefslogtreecommitdiff
path: root/minecproxy/ptimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'minecproxy/ptimer.h')
-rw-r--r--minecproxy/ptimer.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/minecproxy/ptimer.h b/minecproxy/ptimer.h
new file mode 100644
index 0000000..0b53590
--- /dev/null
+++ b/minecproxy/ptimer.h
@@ -0,0 +1,33 @@
+#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