diff options
author | AndersBroman <anders.broman@ericsson.com> | 2017-11-23 14:06:34 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-11-23 14:46:20 +0000 |
commit | 243fa8c4416c00ff1958fe837c401028ef7ca901 (patch) | |
tree | aa1feffd63b806199615386bdb0fe924cb10a66b /wsutil | |
parent | b6f5ee68f646715db094e55aa33b0810d0da1814 (diff) |
[glib-compat] g_async_queue_timeout_pop() needed for older glibs
(2.31.18)
Change-Id: I727c8548c29b3409fab819dce072e86153232911
Reviewed-on: https://code.wireshark.org/review/24550
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/glib-compat.c | 19 | ||||
-rw-r--r-- | wsutil/glib-compat.h | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/wsutil/glib-compat.c b/wsutil/glib-compat.c index 4691a5576f..7dd67d16a7 100644 --- a/wsutil/glib-compat.c +++ b/wsutil/glib-compat.c @@ -110,6 +110,25 @@ g_ptr_array_new_full(guint reserved_size, } #endif /* GLIB_CHECK_VERSION(2, 30, 0)*/ +#if !GLIB_CHECK_VERSION(2,31,18) +/** +Code copied from dumpcap.c +*/ +gpointer +g_async_queue_timeout_pop(GAsyncQueue *queue, + guint64 timeout) +{ + GTimeVal wait_time; + gpointer q_status; + + g_get_current_time(&wait_time); + g_time_val_add(&wait_time, timeout); + q_status = g_async_queue_timed_pop(queue, &wait_time); + + return q_status; +} + +#endif /* GLIB_CHECK_VERSION(2,31,18)*/ /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/wsutil/glib-compat.h b/wsutil/glib-compat.h index 54632e8ab3..1acf587c19 100644 --- a/wsutil/glib-compat.h +++ b/wsutil/glib-compat.h @@ -34,4 +34,8 @@ WS_DLL_PUBLIC gint64 g_get_monotonic_time (void); WS_DLL_PUBLIC GPtrArray* g_ptr_array_new_full(guint reserved_size, GDestroyNotify element_free_func); #endif /* !GLIB_CHECK_VERSION(2, 30, 0) */ +#if !GLIB_CHECK_VERSION(2,31,18) +WS_DLL_PUBLIC gpointer g_async_queue_timeout_pop(GAsyncQueue *queue, guint64 timeout); +#endif /* !GLIB_CHECK_VERSION(2,31,18) */ + #endif /* GLIB_COMPAT_H */ |