#endif
#endif
+/* for g_thread_new */
+#include "wsutil/glib-compat.h"
+
#ifdef DEBUG_CHILD_DUMPCAP
FILE *debug_log; /* for logging debug messages to */
/* a file if DEBUG_CHILD_DUMPCAP */
}
#ifdef _WIN32
else {
-#if GLIB_CHECK_VERSION(2,31,0)
g_thread_new("cap_pipe_open_live", &cap_thread_read, pcap_src);
-#else
- g_thread_create(&cap_thread_read, pcap_src, FALSE, NULL);
-#endif
bh->block_type = type;
pcap_src->cap_pipe_buf = (char *) &bh->block_total_length;
${GCRYPT_LIBRARIES}
${GEOIP_LIBRARIES}
${GLIB2_LIBRARIES}
+ ${GTHREAD2_LIBRARIES}
${GNUTLS_LIBRARIES}
${KERBEROS_LIBRARIES}
${LUA_LIBRARIES}
)
add_executable(make-dissectors make-dissectors.c)
-target_link_libraries(make-dissectors ${GLIB2_LIBRARIES})
+# wsutil is only required for glib-compat.c
+target_link_libraries(make-dissectors ${GLIB2_LIBRARIES} wsutil)
#
# We pass the arguments to make-dissectors in a file to avoid limitations
alloc_address_wmem(NULL, &entry->addr, AT_IPv4, sizeof ipaddr, &ipaddr);
entry->port = port;
entry->privkey = NULL;
- if (!g_hash_table_contains(rsakeys, entry)) {
+ if (g_hash_table_lookup(rsakeys, entry) == NULL) {
entry->privkey = convo->privkey;
g_hash_table_insert(rsakeys, entry, entry->privkey);
} else {
{
volatile gboolean status = TRUE;
+ /*
+ * proto_init -> register_all_protocols -> g_async_queue_new which
+ * requires threads to be initialized. This happens automatically with
+ * GLib 2.32, before that g_thread_init must be called. But only since
+ * GLib 2.24, multiple invocations are allowed. Check for an earlier
+ * invocation just in case.
+ */
+#if !GLIB_CHECK_VERSION(2,31,0)
+# if !GLIB_CHECK_VERSION(2,24,0)
+ if (!g_thread_get_initialized())
+# endif
+ g_thread_init(NULL);
+#endif
+
/* initialize memory allocation subsystem */
wmem_init();
)
add_executable(make-taps make-taps.c)
-target_link_libraries(make-taps ${GLIB2_LIBRARIES})
+# wsutil is only required for glib-compat.c
+target_link_libraries(make-taps ${GLIB2_LIBRARIES} wsutil)
if (HTML_HELP_COMPILER)
add_definitions(-DHHC_DIR)
#if !GLIB_CHECK_VERSION(2,31,0)
-GThread *g_thread_new(const gchar *name _U_, GThreadFunc func, gpointer data)
+GThread *g_thread_new(const gchar *name, GThreadFunc func, gpointer data)
{
- return g_thread_create(func, data, TRUE, NULL);
+ GError *error = NULL;
+ GThread *thread;
+
+ thread = g_thread_create(func, data, TRUE, &error);
+
+ if G_UNLIKELY (thread == NULL)
+ g_error ("creating thread '%s': %s", name ? name : "", error->message);
+
+ return thread;
}
#endif /* GLIB_CHECK_VERSION(2,31,0)*/
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) */