From 15b3338e97ddcd8b64ce2e90dad43bb52acd9eaf Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Wed, 7 Aug 2013 11:44:29 +0200 Subject: [PATCH] select.c: Improve comment Be more verbose about why a longer timeout makes sense. --- select.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.47.2