diff options
author | Gerald Combs <gerald@zing.org> | 2017-11-28 11:04:16 -0800 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-11-29 04:43:41 +0000 |
commit | 67ffa3cf7da172df53a821d5cd4c1a6a849f4087 (patch) | |
tree | d6f0d7dd707776eaa1742da2ad1cd4f1195c0532 /wsutil | |
parent | 041e3e7c27c78308d0d515171f52a39f8260782b (diff) |
Threads: Set lifetimes and add a compatibility routine.
Join the protocol registration threads so that they call g_thread_unref
which in turn detaches/terminates the thread. This gets rid of many TSan
and DRD errors here. The remaining ones appear to be false positives.
Add g_thread_new to glib-compat (untested).
Change-Id: I4beb6746ed08656715cf7870ac63ff80cf1ef871
Reviewed-on: https://code.wireshark.org/review/24619
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/glib-compat.c | 9 | ||||
-rw-r--r-- | wsutil/glib-compat.h | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/wsutil/glib-compat.c b/wsutil/glib-compat.c index 7dd67d16a7..8c2092edf2 100644 --- a/wsutil/glib-compat.c +++ b/wsutil/glib-compat.c @@ -129,6 +129,15 @@ g_async_queue_timeout_pop(GAsyncQueue *queue, } #endif /* GLIB_CHECK_VERSION(2,31,18)*/ + + +#if !GLIB_CHECK_VERSION(2,31,0) +GThread *g_thread_new(const gchar *name _U_, GThreadFunc func, gpointer data) +{ + return g_thread_create(func, data, TRUE, NULL); +} +#endif /* GLIB_CHECK_VERSION(2,31,0)*/ + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/wsutil/glib-compat.h b/wsutil/glib-compat.h index 1acf587c19..a1f1d764d7 100644 --- a/wsutil/glib-compat.h +++ b/wsutil/glib-compat.h @@ -38,4 +38,9 @@ WS_DLL_PUBLIC GPtrArray* g_ptr_array_new_full(guint reserved_size, GDestroyNotif WS_DLL_PUBLIC gpointer g_async_queue_timeout_pop(GAsyncQueue *queue, guint64 timeout); #endif /* !GLIB_CHECK_VERSION(2,31,18) */ +// joinable = TRUE, error = NULL +#if !GLIB_CHECK_VERSION(2,31,0) +WS_DLL_PUBLIC GThread *g_thread_new (const gchar *name, GThreadFunc func, gpointer data); +#endif /* !GLIB_CHECK_VERSION(2,31,0) */ + #endif /* GLIB_COMPAT_H */ |