From: <bni...@us...> - 2007-06-14 22:30:20
|
Revision: 792 http://svn.sourceforge.net/ganglia/?rev=792&view=rev Author: bnicholes Date: 2007-06-14 15:30:22 -0700 (Thu, 14 Jun 2007) Log Message: ----------- explicitly handle the sigint signal Modified Paths: -------------- trunk/monitor-core/gmond/gmond.c Modified: trunk/monitor-core/gmond/gmond.c =================================================================== --- trunk/monitor-core/gmond/gmond.c 2007-06-14 17:11:01 UTC (rev 791) +++ trunk/monitor-core/gmond/gmond.c 2007-06-14 22:30:22 UTC (rev 792) @@ -2031,6 +2031,12 @@ apr_pool_clear( pool ); } +int done = 0; +void sig_handler(int i) +{ + done = 1; +} + int main ( int argc, char *argv[] ) { @@ -2101,6 +2107,7 @@ apr_gethostname( myname, APRMAXHOSTLEN+1, global_context); apr_signal( SIGPIPE, SIG_IGN ); + apr_signal( SIGINT, sig_handler ); /* This must occur before we setuid_if_necessary() particularly on freebsd * where we need to be root to access /dev/mem to initialize metric collection */ @@ -2139,7 +2146,7 @@ last_cleanup = next_collection = now = apr_time_now(); /* Loop */ - for(;;) + for(;!done;) { /* Make sure we never wait for negative seconds (shouldn't happen) */ apr_interval_time_t wait = next_collection >= now ? next_collection - now : 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |