#include <stdio.h>
#include <unistd.h>
#include <import/ist.h>
-#include <haproxy/activity.h>
#include <haproxy/api.h>
#include <haproxy/atomic.h>
#include <haproxy/fd-t.h>
#include <haproxy/global.h>
#include <haproxy/thread.h>
-#include <haproxy/ticks.h>
/* public variables */
/* close all FDs starting from <start> */
void my_closefrom(int start);
+int compute_poll_timeout(int next);
+
/* disable the specified poller */
void disable_poller(const char *poller_name);
_HA_ATOMIC_INC(&ha_used_fds);
}
-/* Computes the bounded poll() timeout based on the next expiration timer <next>
- * by bounding it to MAX_DELAY_MS. <next> may equal TICK_ETERNITY. The pollers
- * just needs to call this function right before polling to get their timeout
- * value. Timeouts that are already expired (possibly due to a pending event)
- * are accounted for in activity.poll_exp.
- */
-static inline int compute_poll_timeout(int next)
-{
- int wait_time;
-
- if (!tick_isset(next))
- wait_time = MAX_DELAY_MS;
- else if (tick_is_expired(next, now_ms)) {
- activity[tid].poll_exp++;
- wait_time = 0;
- }
- else {
- wait_time = TICKS_TO_MS(tick_remain(now_ms, next)) + 1;
- if (wait_time > MAX_DELAY_MS)
- wait_time = MAX_DELAY_MS;
- }
- return wait_time;
-}
-
/* These are replacements for FD_SET, FD_CLR, FD_ISSET, working on uints */
static inline void hap_fd_set(int fd, unsigned int *evts)
{
#include <haproxy/global.h>
#include <haproxy/log.h>
#include <haproxy/port_range.h>
+#include <haproxy/ticks.h>
#include <haproxy/tools.h>
}
#endif // defined(USE_POLL)
+/* Computes the bounded poll() timeout based on the next expiration timer <next>
+ * by bounding it to MAX_DELAY_MS. <next> may equal TICK_ETERNITY. The pollers
+ * just needs to call this function right before polling to get their timeout
+ * value. Timeouts that are already expired (possibly due to a pending event)
+ * are accounted for in activity.poll_exp.
+ */
+int compute_poll_timeout(int next)
+{
+ int wait_time;
+
+ if (!tick_isset(next))
+ wait_time = MAX_DELAY_MS;
+ else if (tick_is_expired(next, now_ms)) {
+ activity[tid].poll_exp++;
+ wait_time = 0;
+ }
+ else {
+ wait_time = TICKS_TO_MS(tick_remain(now_ms, next)) + 1;
+ if (wait_time > MAX_DELAY_MS)
+ wait_time = MAX_DELAY_MS;
+ }
+ return wait_time;
+}
+
/* disable the specified poller */
void disable_poller(const char *poller_name)
{