diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-09-06 08:58:20 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-09-06 08:58:20 +0000 |
commit | e318b2ff8a2e65be74aaa41d0c9c1e752d2634d4 (patch) | |
tree | be7fd89f4c6d5c8b1f43fc440f697c48be33518b /gtk2 | |
parent | 232db679b51a1c2c5f85ea146606e56635b9aa42 (diff) | |
download | wireshark-e318b2ff8a2e65be74aaa41d0c9c1e752d2634d4.tar.gz wireshark-e318b2ff8a2e65be74aaa41d0c9c1e752d2634d4.tar.bz2 wireshark-e318b2ff8a2e65be74aaa41d0c9c1e752d2634d4.zip |
Moved access of the mutex protecting the critical region into gtk2/main.c
so that it would be possible to share an unmodified gtk2-rpcstat.c with
any future gtk1-ethereal support for the tap system.
Anyone reading this cvs entry:
Perhaps someone could just try to add a draw_all_listeners() to the place in
file.c where it has finished reading or rescanning all packets.
That might work though it wouldnt update in semi-real time but would
be simple and better than nothing.
svn path=/trunk/; revision=6193
Diffstat (limited to 'gtk2')
-rw-r--r-- | gtk2/gtk2-rpcstat.c | 9 | ||||
-rw-r--r-- | gtk2/main.c | 20 |
2 files changed, 23 insertions, 6 deletions
diff --git a/gtk2/gtk2-rpcstat.c b/gtk2/gtk2-rpcstat.c index f705c56e11..9f0ba3f687 100644 --- a/gtk2/gtk2-rpcstat.c +++ b/gtk2/gtk2-rpcstat.c @@ -1,7 +1,7 @@ /* gtk2-rpcstat.c * rpcstat 2002 Ronnie Sahlberg * - * $Id: gtk2-rpcstat.c,v 1.3 2002/09/05 18:48:51 jmayer Exp $ + * $Id: gtk2-rpcstat.c,v 1.4 2002/09/06 08:58:20 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -38,7 +38,6 @@ #include "tap-rpcstat.h" #include "packet-rpc.h" -extern GStaticMutex update_thread_mutex; /* used to keep track of statistics for a specific procedure */ typedef struct _rpc_procedure_t { @@ -253,14 +252,16 @@ rpcstat_find_vers(gpointer *key, gpointer *value _U_, gpointer *user_data _U_) * * there should not be any other critical regions in gtk2 */ +void protect_thread_critical_region(void); +void unprotect_thread_critical_region(void); static void win_destroy_cb(GtkWindow *win _U_, gpointer data) { rpcstat_t *rs=(rpcstat_t *)data; - g_static_mutex_lock(&update_thread_mutex); + protect_thread_critical_region(); remove_tap_listener(rs); - g_static_mutex_unlock(&update_thread_mutex); + unprotect_thread_critical_region(); g_free(rs->procedures); g_free(rs); diff --git a/gtk2/main.c b/gtk2/main.c index 652d30a662..dd4a46a177 100644 --- a/gtk2/main.c +++ b/gtk2/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.4 2002/09/05 18:48:51 jmayer Exp $ + * $Id: main.c,v 1.5 2002/09/06 08:58:20 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1195,8 +1195,14 @@ set_autostop_criterion(const char *autostoparg) #endif -GStaticMutex update_thread_mutex = G_STATIC_MUTEX_INIT; +/* if these three functions are copied to gtk1 ethereal, since gtk1 does not + use threads all updte_thread_mutex can be dropped and protect/unprotect + would just be empty functions. + This allows gtk2-rpcstat.c and friends to be copied unmodified to + gtk1-ethereal and it will just work. + */ +static GStaticMutex update_thread_mutex = G_STATIC_MUTEX_INIT; gpointer update_thread(gpointer data _U_) { @@ -1213,6 +1219,16 @@ update_thread(gpointer data _U_) } return NULL; } +void +protect_thread_critical_region(void) +{ + g_static_mutex_lock(&update_thread_mutex); +} +void +unprotect_thread_critical_region(void) +{ + g_static_mutex_unlock(&update_thread_mutex); +} /* And now our feature presentation... [ fade to music ] */ int |