thread_idle_now();
thread_harmless_now();
- /* now let's wait for polled events */
- wait_time = wake ? 0 : compute_poll_timeout(exp);
+ /* Now let's wait for polled events.
+ * Check if the signal queue is not empty in case we received a signal
+ * before entering the loop, so we don't wait MAX_DELAY_MS for nothing */
+ wait_time = (wake | signal_queue_len) ? 0 : compute_poll_timeout(exp);
clock_entering_poll();
do {
int timeout = (global.tune.options & GTUNE_BUSY_POLLING) ? 0 : wait_time;
thread_idle_now();
thread_harmless_now();
- /*
- * Determine how long to wait for events to materialise on the port.
- */
- wait_time = wake ? 0 : compute_poll_timeout(exp);
+ /* Now let's wait for polled events.
+ * Check if the signal queue is not empty in case we received a signal
+ * before entering the loop, so we don't wait MAX_DELAY_MS for nothing */
+ wait_time = (wake | signal_queue_len) ? 0 : compute_poll_timeout(exp);
clock_entering_poll();
do {
}
fd_nbupdt = 0;
- /* now let's wait for events */
- wait_time = wake ? 0 : compute_poll_timeout(exp);
+ /* Now let's wait for polled events.
+ * Check if the signal queue is not empty in case we received a signal
+ * before entering the loop, so we don't wait MAX_DELAY_MS for nothing */
+ wait_time = (wake | signal_queue_len) ? 0 : compute_poll_timeout(exp);
fd = global.tune.maxpollevents;
clock_entering_poll();
#include <haproxy/clock.h>
#include <haproxy/fd.h>
#include <haproxy/global.h>
+#include <haproxy/signal.h>
#include <haproxy/task.h>
#include <haproxy/ticks.h>
}
}
- /* now let's wait for events */
- wait_time = wake ? 0 : compute_poll_timeout(exp);
+ /* Now let's wait for polled events.
+ * Check if the signal queue is not empty in case we received a signal
+ * before entering the loop, so we don't wait MAX_DELAY_MS for nothing */
+ wait_time = (wake | signal_queue_len) ? 0 : compute_poll_timeout(exp);
clock_entering_poll();
status = poll(poll_events, nbfd, wait_time);
clock_update_date(wait_time, status);