From 3ac3a60229ee50fe4cbff786aa2aa3643eb594d1 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Thu, 25 Sep 2014 11:10:30 +0100 Subject: [PATCH] Prevent epoll_wait call with a timeout if there are events in the queue to be processed --- server/core/poll.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/core/poll.c b/server/core/poll.c index fa2be4928..fd383e180 100644 --- a/server/core/poll.c +++ b/server/core/poll.c @@ -423,7 +423,12 @@ DCB *zombies = NULL; nfds, eno))); } - else if (nfds == 0) + /* + * If there are no new descriptors from the non-blocking call + * and nothing to proces on the event queue then for do a + * blocking call to epoll_wait. + */ + else if (nfds == 0 && process_pollq(thread_id) == 0) { atomic_add(&n_waiting, 1); nfds = epoll_wait(epoll_fd,