aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2011-11-09 23:43:50 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2011-11-09 23:43:50 +0000
commitc7d5a6720d84c0571e08f1de212b2d61bcd9bdc1 (patch)
tree94d5184e90d9548291480b0a6d94ec8898862d6d /dumpcap.c
parentb9d2890bf6df0904f506dfa73ec4a3058cebeef6 (diff)
Try to fix the GLib thread API deprecations listed in bug 6552.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39776 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/dumpcap.c b/dumpcap.c
index e7b5980c14..df758a4e00 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -2298,7 +2298,12 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
pcap_opts->cap_pipe_state = 0;
pcap_opts->cap_pipe_err = PIPOK;
#ifdef _WIN32
+#if GLIB_CHECK_VERSION(2,31,0)
+ pcap_opts->cap_pipe_read_mtx = g_malloc(sizeof(GMutex));
+ g_mutex_init(pcap_opts->cap_pipe_read_mtx);
+#else
pcap_opts->cap_pipe_read_mtx = g_mutex_new();
+#endif
pcap_opts->cap_pipe_pending_q = g_async_queue_new();
pcap_opts->cap_pipe_done_q = g_async_queue_new();
#endif
@@ -3189,7 +3194,12 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
pcap_queue_packets = 0;
for (i = 0; i < global_ld.pcaps->len; i++) {
pcap_opts = g_array_index(global_ld.pcaps, pcap_options *, i);
+#if GLIB_CHECK_VERSION(2,31,0)
+ /* XXX - Add an interface name here? */
+ pcap_opts->tid = g_thread_new("Capture read", pcap_read_handler, pcap_opts);
+#else
pcap_opts->tid = g_thread_create(pcap_read_handler, pcap_opts, TRUE, NULL);
+#endif
}
}
while (global_ld.go) {
@@ -3848,8 +3858,10 @@ main(int argc, char *argv[])
/* Initialize the pcaps list */
global_ld.pcaps = g_array_new(FALSE, FALSE, sizeof(pcap_options *));
+#if !GLIB_CHECK_VERSION(2,31,0)
/* Initialize the thread system */
g_thread_init(NULL);
+#endif
#ifdef _WIN32
/* Load wpcap if possible. Do this before collecting the run-time version information */