]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: allow infinite sleep in poll() 676/head
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 5 Jun 2017 20:18:48 +0000 (20:18 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 6 Jun 2017 14:23:42 +0000 (14:23 +0000)
If fd_poll() is called with no file descriptors, an incorrect check in
the function prelude causes it to return instantly; for a thread that
wishes to poll but has no file descriptors, this results in busy
waiting. Desired behavior is to block.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/thread.c

index 848e39e1aef3b067f0eb52133ab6ecb7e41e7af5..2280b963164c553af7f53a1817d72116cb096912 100644 (file)
@@ -647,9 +647,6 @@ static int
 fd_poll (struct thread_master *m, struct pollfd *pfds, nfds_t pfdsize,
          nfds_t count, struct timeval *timer_wait)
 {
-  if (count == 0)
-    return 0;
-
   /* If timer_wait is null here, that means poll() should block indefinitely,
    * unless the thread_master has overriden it by setting ->selectpoll_timeout.
    * If the value is positive, it specifies the maximum number of milliseconds