aboutsummaryrefslogtreecommitdiff
path: root/include/glib-compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/glib-compat.h')
-rw-r--r--include/glib-compat.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 8aa77afd62..8d25900700 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -24,4 +24,16 @@ static inline guint g_timeout_add_seconds(guint interval, GSourceFunc function,
}
#endif
+#if !GLIB_CHECK_VERSION(2, 20, 0)
+/*
+ * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
+ * on older systems.
+ */
+static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
+{
+ GMainContext *ctx = g_main_context_default();
+ return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
+}
+#endif
+
#endif