From: Richard Hartmann Date: Wed, 7 Aug 2013 09:44:29 +0000 (+0200) Subject: select.c: Improve comment X-Git-Tag: v0.86~30^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15b3338e97ddcd8b64ce2e90dad43bb52acd9eaf;p=thirdparty%2Fmtr.git select.c: Improve comment Be more verbose about why a longer timeout makes sense. --- diff --git a/select.c b/select.c index 9adec9b..e46d697 100644 --- a/select.c +++ b/select.c @@ -105,8 +105,12 @@ void select_loop(void) { do { if(anyset || paused) { + /* Set timeout to 0.1s. + * While this is almost instantaneous for human operators, + * it's slow enough for computers to go do something else; + * this prevents mtr from hogging 100% CPU time on one core. + */ selecttime.tv_sec = 0; - // timeout is 0.1s: Almost instantaneous for human operators. selecttime.tv_usec = 100000; rv = select(maxfd, (void *)&readfd, &writefd, NULL, &selecttime);