summaryrefslogtreecommitdiffstats
path: root/common/glib-ectomy.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/glib-ectomy.h')
-rw-r--r--common/glib-ectomy.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/common/glib-ectomy.h b/common/glib-ectomy.h
index e921b40d..56dac08b 100644
--- a/common/glib-ectomy.h
+++ b/common/glib-ectomy.h
@@ -28,16 +28,36 @@ typedef ssize_t gssize;
#define SSIZE_MAX INT_MAX
#endif
+#define MIN_TIMEOUT(a, b) (((a) < (b)) ? (a) : (b))
+
typedef struct _GIOChannel {
int fd;
} GIOChannel;
+typedef int (timeout_func_t)(void *data);
+
+typedef struct {
+ glong tv_sec;
+ glong tv_usec;
+} time_val_t;
+
+struct timeout {
+ guint id;
+ guint interval;
+ time_val_t expiration;
+ void *data;
+ timeout_func_t *func;
+};
+
typedef struct _GMainContext {
- int dummy;
+ guint next_id;
+ glong timeout;
+ struct slist *ltimeout;
} GMainContext;
typedef struct _GMainLoop {
int bail;
+ GMainContext *context;
} GMainLoop;
typedef enum {
@@ -89,9 +109,14 @@ void g_io_remove_watch(guint id);
GMainLoop *g_main_loop_new(GMainContext *context, gboolean is_running);
void g_main_loop_run(GMainLoop *loop);
void g_main_loop_quit(GMainLoop *loop);
+void g_main_loop_unref(GMainLoop *loop);
+guint g_timeout_add(guint interval, timeout_func_t *func, void *data);
+gint g_timeout_remove(const guint id);
+
#define g_main_new(is_running) g_main_loop_new(NULL, is_running);
#define g_main_run(loop) g_main_loop_run(loop)
#define g_main_quit(loop) g_main_loop_quit(loop)
+#define g_main_unref(loop) g_main_loop_unref(loop)
#endif /* __GLIB_ECTOMY_H */