diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-09-05 06:46:38 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-09-05 06:46:38 +0000 |
commit | a26f9d51076bc632302dc62bfc2be6be56a6408a (patch) | |
tree | b2e86de21e4f1573b293b3030213bb1994641316 /gtk2/main.c | |
parent | 14c0a66cc8c06f7dd59f8fbcf1518d559f47c0ba (diff) |
Added a mutex to protect a critical region in Gtk2 where the list can be
modified while the draw thread is walking it.
Changed the cmdline switch to -z so the same one can be used both for
ethereal and tethereal.
Updated man pages to reflect the RPCSTAT feature.
(Try this with Tools/Statistics/ONC-RPC/RTT and load a capture containing
onc-rpc. )
svn path=/trunk/; revision=6189
Diffstat (limited to 'gtk2/main.c')
-rw-r--r-- | gtk2/main.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/gtk2/main.c b/gtk2/main.c index 2757484101..1dcd6bede5 100644 --- a/gtk2/main.c +++ b/gtk2/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.2 2002/09/04 22:19:42 sahlberg Exp $ + * $Id: main.c,v 1.3 2002/09/05 06:46:38 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -135,6 +135,7 @@ #include "image/clist_ascend.xpm" #include "image/clist_descend.xpm" #include "../tap.h" +#include "gtk2-rpcstat.h" #ifdef WIN32 #include "capture-wpcap.h" @@ -1211,13 +1212,18 @@ set_autostop_criterion(const char *autostoparg) } #endif + +GStaticMutex update_thread_mutex = G_STATIC_MUTEX_INIT; + gpointer update_thread(gpointer data _U_) { while(1){ struct timeval tv1, tv2; gettimeofday(&tv1, NULL); + g_static_mutex_lock(&update_thread_mutex); draw_tap_listeners(FALSE); + g_static_mutex_unlock(&update_thread_mutex); do{ g_thread_yield(); gettimeofday(&tv2, NULL); @@ -1272,7 +1278,7 @@ main(int argc, char *argv[]) gboolean prefs_write_needed = FALSE; -#define OPTSTRING_INIT "a:b:B:c:f:hi:klm:nN:o:pP:Qr:R:Ss:t:T:w:v" +#define OPTSTRING_INIT "a:b:B:c:f:hi:klm:nN:o:pP:Qr:R:Ss:t:T:w:vz:" #ifdef HAVE_LIBPCAP #ifdef WIN32 @@ -1708,6 +1714,26 @@ main(int argc, char *argv[]) break; #endif + case 'z': + if(!strncmp(optarg,"rpc,",4)){ + if(!strncmp(optarg,"rpc,rtt,",8)){ + int rpcprogram, rpcversion; + if(sscanf(optarg,"rpc,rtt,%d,%d",&rpcprogram,&rpcversion)==2){ + gtk2_rpcstat_init(rpcprogram,rpcversion); + } else { + fprintf(stderr, "ethereal: invalid \"-z rpc,rtt,<program>,<version>\" argument\n"); + exit(1); + } + } else { + fprintf(stderr, "ethereal: invalid -z argument. Argument must be \"-z rpc,rtt,...\"\n"); + exit(1); + } + } else { + fprintf(stderr, "ethereal: invalid -z argument. Argument must be \"-z rpc,...\"\n"); + exit(1); + } + break; + #ifdef _WIN32 #ifdef HAVE_LIBPCAP /* Hidden option supporting Sync mode */ |