block: qemu-iotests - update 085 to use common.qemu
[qemu/ar7.git] / include / glib-compat.h
blob8d259007009a8e66072b0b406bbaedc2c8339134
1 /*
2 * GLIB Compatibility Functions
4 * Copyright IBM, Corp. 2013
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
14 #ifndef QEMU_GLIB_COMPAT_H
15 #define QEMU_GLIB_COMPAT_H
17 #include <glib.h>
19 #if !GLIB_CHECK_VERSION(2, 14, 0)
20 static inline guint g_timeout_add_seconds(guint interval, GSourceFunc function,
21 gpointer data)
23 return g_timeout_add(interval * 1000, function, data);
25 #endif
27 #if !GLIB_CHECK_VERSION(2, 20, 0)
29 * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
30 * on older systems.
32 static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
34 GMainContext *ctx = g_main_context_default();
35 return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
37 #endif
39 #endif