[MEDIUM] pollers: don't wait if a signal is pending

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.
This commit is contained in:
Willy Tarreau 2009-05-10 09:57:21 +02:00
parent 2985794ca9
commit 332740dab2
5 changed files with 10 additions and 5 deletions

View 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;

View 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);

View 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;

View 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);

View 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