]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
select.c: Improve comment 22/head
authorRichard Hartmann <richih.mailinglist@gmail.com>
Wed, 7 Aug 2013 09:44:29 +0000 (11:44 +0200)
committerRichard Hartmann <richih.mailinglist@gmail.com>
Wed, 7 Aug 2013 09:44:29 +0000 (11:44 +0200)
Be more verbose about why a longer timeout makes sense.

select.c

index 9adec9bb32f5e417e109197375206488cb14b92a..e46d69720c3c1238e1b93cc8516063437dc0b3b8 100644 (file)
--- 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);