diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-03-03 20:36:47 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-03-03 20:36:47 -0800 |
| commit | c17a1dd3f5333da59355ecc3f8788a0396a8f72d (patch) | |
| tree | 77e6790df0fa45b57fafa749f3380fc4b8aa230e /src/core/timer.h | |
| parent | 97614393e450b6c6813021f0e733b864a6265872 (diff) | |
| download | nng-c17a1dd3f5333da59355ecc3f8788a0396a8f72d.tar.gz nng-c17a1dd3f5333da59355ecc3f8788a0396a8f72d.tar.bz2 nng-c17a1dd3f5333da59355ecc3f8788a0396a8f72d.zip | |
Timer implementation. Operations can timeout now?
Diffstat (limited to 'src/core/timer.h')
| -rw-r--r-- | src/core/timer.h | 33 |
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 |
