aboutsummaryrefslogtreecommitdiff
path: root/src/core/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/timer.h')
-rw-r--r--src/core/timer.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/timer.h b/src/core/timer.h
new file mode 100644
index 00000000..a5bd4633
--- /dev/null
+++ b/src/core/timer.h
@@ -0,0 +1,33 @@
+//
+// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#ifndef CORE_TIMER_H
+#define CORE_TIMER_H
+
+#include "core/defs.h"
+#include "core/list.h"
+
+// For the sake of simplicity, we just maintain a single global timer thread.
+
+struct nni_timer_node {
+ nni_time t_expire;
+ nni_cb t_cb;
+ void * t_arg;
+ nni_list_node t_node;
+ int t_sched;
+};
+
+typedef struct nni_timer_node nni_timer_node;
+
+extern void nni_timer_schedule(nni_timer_node *);
+extern void nni_timer_cancel(nni_timer_node *);
+extern int nni_timer_sys_init(void);
+extern void nni_timer_sys_fini(void);
+
+#endif // CORE_TIMER_H