]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] pollers: don't wait if a signal is pending
authorWilly Tarreau <w@1wt.eu>
Sun, 10 May 2009 07:57:21 +0000 (09:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 10 May 2009 07:57:21 +0000 (09:57 +0200)
If an asynchronous signal is received outside of the poller, we don't
want the poller to wait for a timeout to occur before processing it,
so we set its timeout to zero, just like we do with pending tasks in
the run queue.

src/ev_epoll.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/ev_sepoll.c

index fdb31ec13e2317219fa0522fff24f80599b16c96..345b0b2ac0a1bfb30b0f9dabdfa14fc88dcefa53 100644 (file)
@@ -24,6 +24,7 @@
 #include <types/fd.h>
 #include <types/global.h>
 
+#include <proto/signal.h>
 #include <proto/task.h>
 
 #if defined(USE_MY_EPOLL)
@@ -232,7 +233,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                fd_flush_changes();
 
        /* now let's wait for events */
-       if (run_queue)
+       if (run_queue || signal_queue_len)
                wait_time = 0;
        else if (!exp)
                wait_time = MAX_DELAY_MS;
index f5201060502aa11d25b47bf967a6932eea94f628..7e626d112db3d019b3a10836fb16d2a6a31e366b 100644 (file)
@@ -30,6 +30,7 @@
 #include <types/global.h>
 
 #include <proto/fd.h>
+#include <proto/signal.h>
 #include <proto/task.h>
 
 /* private data */
@@ -109,7 +110,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
        timeout.tv_sec  = 0;
        timeout.tv_nsec = 0;
 
-       if (!run_queue) {
+       if (!run_queue && !signal_queue_len) {
                if (!exp) {
                        delta_ms        = MAX_DELAY_MS;
                        timeout.tv_sec  = (MAX_DELAY_MS / 1000);
index a86c59991669663d181d228eb59f65d2aaf8f5d4..f5d011eea4bfe5595d8aee0a05ffe81c86ac088c 100644 (file)
@@ -23,6 +23,7 @@
 #include <types/global.h>
 
 #include <proto/fd.h>
+#include <proto/signal.h>
 #include <proto/task.h>
 
 
@@ -124,7 +125,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
        }
       
        /* now let's wait for events */
-       if (run_queue)
+       if (run_queue || signal_queue_len)
                wait_time = 0;
        else if (!exp)
                wait_time = MAX_DELAY_MS;
index 7fe7c239984c9011d283dbf22cec55c83e41cf50..5a87282d29f5d196353ad1edf9ebeb9fffdbd243 100644 (file)
@@ -22,6 +22,7 @@
 #include <types/global.h>
 
 #include <proto/fd.h>
+#include <proto/signal.h>
 #include <proto/task.h>
 
 
@@ -92,7 +93,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
        delta.tv_sec  = 0;
        delta.tv_usec = 0;
 
-       if (!run_queue) {
+       if (!run_queue && !signal_queue_len) {
                if (!exp) {
                        delta_ms      = MAX_DELAY_MS;
                        delta.tv_sec  = (MAX_DELAY_MS / 1000);
index ee6284b07ce638697ec0bbea302d4889b2ea2c36..a093693f399b81d8b1462c7feaa92c7522ad5d37 100644 (file)
@@ -59,6 +59,7 @@
 #include <types/global.h>
 
 #include <proto/fd.h>
+#include <proto/signal.h>
 #include <proto/task.h>
 
 #if defined(USE_MY_EPOLL)
@@ -471,7 +472,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
        }
        last_skipped = 0;
 
-       if (nbspec || status || run_queue) {
+       if (nbspec || status || run_queue || signal_queue_len) {
                /* Maybe we have processed some events that we must report, or
                 * maybe we still have events in the spec list, or there are
                 * some tasks left pending in the run_queue, so we must not