aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2011-11-09 23:43:50 +0000
committerGerald Combs <gerald@wireshark.org>2011-11-09 23:43:50 +0000
commitaa0c9c965c15befd2ed141a10e8923b09bdbe435 (patch)
tree94d5184e90d9548291480b0a6d94ec8898862d6d /tshark.c
parent612dcc3c6b9ccf498b65fe9504e16e62181bdd14 (diff)
Try to fix the GLib thread API deprecations listed in bug 6552.
svn path=/trunk/; revision=39776
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/tshark.c b/tshark.c
index 1697fd8f73..e5c7d3436d 100644
--- a/tshark.c
+++ b/tshark.c
@@ -1888,7 +1888,7 @@ typedef struct pipe_input_tag {
pipe_input_cb_t input_cb;
guint pipe_input_id;
#ifdef _WIN32
- GStaticMutex callback_running;
+ GMutex *callback_running;
#endif
} pipe_input_t;
@@ -1907,8 +1907,7 @@ pipe_timer_cb(gpointer data)
pipe_input_t *pipe_input_p = data;
gint iterations = 0;
-
- g_static_mutex_lock (&pipe_input_p->callback_running);
+ g_mutex_lock (pipe_input_p->callback_running);
/* try to read data from the pipe only 5 times, to avoid blocking */
while(iterations < 5) {
@@ -1934,7 +1933,7 @@ pipe_timer_cb(gpointer data)
if (!pipe_input_p->input_cb(pipe_input_p->source, pipe_input_p->user_data)) {
g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: input pipe closed, iterations: %u", iterations);
/* pipe closed, return false so that the timer is stopped */
- g_static_mutex_unlock (&pipe_input_p->callback_running);
+ g_mutex_unlock (pipe_input_p->callback_running);
return FALSE;
}
}
@@ -1949,7 +1948,7 @@ pipe_timer_cb(gpointer data)
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: finished with iterations: %u, new timer", iterations);*/
- g_static_mutex_unlock (&pipe_input_p->callback_running);
+ g_mutex_unlock (pipe_input_p->callback_running);
/* we didn't stopped the timer, so let it run */
return TRUE;
@@ -1967,7 +1966,12 @@ pipe_input_set_handler(gint source, gpointer user_data, int *child_process, pipe
pipe_input.input_cb = input_cb;
#ifdef _WIN32
- g_static_mutex_init(&pipe_input.callback_running);
+#if GLIB_CHECK_VERSION(2,31,0)
+ pipe_input.callback_running = g_malloc(sizeof(GMutex));
+ g_mutex_init(pipe_input.callback_running);
+#else
+ pipe_input.callback_running = g_mutex_new();
+#endif
/* Tricky to use pipes in win9x, as no concept of wait. NT can
do this but that doesn't cover all win32 platforms. GTK can do
this but doesn't seem to work over processes. Attempt to do