summaryrefslogtreecommitdiffstats
path: root/clib/timer.h
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@us.ibm.com>2014-06-30 22:10:16 -0500
committerPatrick Williams <iawillia@us.ibm.com>2014-07-02 22:49:29 -0500
commitbf4630076762d9c20c16c80c1c791f352b046dd1 (patch)
treeefc67bad010a28fd1abf5aeeefda2a969514fd97 /clib/timer.h
downloadffs-bf4630076762d9c20c16c80c1c791f352b046dd1.tar.gz
ffs-bf4630076762d9c20c16c80c1c791f352b046dd1.zip
Port FFS tools over from Building Block repository.
Diffstat (limited to 'clib/timer.h')
-rw-r--r--clib/timer.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/clib/timer.h b/clib/timer.h
new file mode 100644
index 0000000..48dc748
--- /dev/null
+++ b/clib/timer.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) International Business Machines Corp., 2014
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * File: timer.h
+ * Author: Shaun Wetzstein <shaun@us.ibm.com>
+ * Descr: Timer
+ * Note:
+ * Date: 10/03/10
+ */
+
+#ifndef __TIMER_H__
+#define __TIMER_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <time.h>
+
+#include <sys/timerfd.h>
+
+#include "attribute.h"
+#include "builtin.h"
+#include "assert.h"
+#include "vector.h"
+
+/* ==================================================================== */
+
+typedef struct timer_struct timer_t;
+typedef struct timer_callback_struct timer_callback_t;
+typedef struct timer_event_struct timer_event_t;
+
+typedef int (*timer_f) (timer_event *);
+
+struct timer_struct {
+ int fd;
+ vector_t callbacks;
+};
+
+struct timer_callback_struct {
+ void *data;
+ timer_f func;
+};
+
+struct timer_event_struct {
+};
+
+/* ======================================================================= */
+
+extern void timer_init(timer *, int) __nonnull((1));
+extern void timer_delete(timer *) __nonnull((1));
+
+extern int timer_fileno(timer *) __nonnull((1));
+
+extern uint32_t timer_add(timer *, const char *, uint32_t,
+ timer_callback *) __nonnull((1, 2));
+extern void timer_remove(timer *, uint32_t) __nonnull((1));
+
+extern void timer_wait(timer *) __nonnull((1));
+
+/* ======================================================================= */
+
+#endif /* __timer_H__ */
OpenPOWER on IntegriCloud