summaryrefslogtreecommitdiffstats
path: root/timeeventq.h
diff options
context:
space:
mode:
Diffstat (limited to 'timeeventq.h')
-rw-r--r--timeeventq.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/timeeventq.h b/timeeventq.h
new file mode 100644
index 0000000..8fd5c02
--- /dev/null
+++ b/timeeventq.h
@@ -0,0 +1,30 @@
+#ifndef footimeeventqhfoo
+#define footimeeventqhfoo
+
+typedef struct _flxTimeEventQueue flxTimeEventQueue;
+typedef struct _flxTimeEvent flxTimeEvent;
+
+#include "prioq.h"
+
+struct _flxTimeEvent {
+ flxTimeEventQueue *queue;
+ flxPrioQueueNode *node;
+ GTimeVal expiry;
+ void (*callback)(flxTimeEvent *e, void *userdata);
+ void *userdata;
+};
+
+struct _flxTimeEventQueue {
+ GSource source;
+ flxPrioQueue *prioq;
+};
+
+flxTimeEventQueue* flx_time_event_queue_new(GMainContext *context);
+void flx_time_event_queue_free(flxTimeEventQueue *q);
+
+flxTimeEvent* flx_time_event_queue_add(flxTimeEventQueue *q, const GTimeVal *timeval, void (*callback)(flxTimeEvent *e, void *userdata), void *userdata);
+void flx_time_event_queue_remove(flxTimeEventQueue *q, flxTimeEvent *e);
+
+void flx_time_event_update(flxTimeEventQueue *q, flxTimeEvent *e, const GTimeVal *timeval);
+
+#endif