From: Tollef Fog Heen Date: Mon, 6 Oct 2008 12:33:48 +0000 (+0200) Subject: Move dsleep to libvarnish/time.c and rename it to TIM_sleep X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=673d32ff3724e5cc1a28a23e1b048018826fa488;p=varnish Move dsleep to libvarnish/time.c and rename it to TIM_sleep --- diff --git a/varnish-cache/bin/varnishd/cache_backend_poll.c b/varnish-cache/bin/varnishd/cache_backend_poll.c index 53c82f24..68ac92a8 100644 --- a/varnish-cache/bin/varnishd/cache_backend_poll.c +++ b/varnish-cache/bin/varnishd/cache_backend_poll.c @@ -91,15 +91,6 @@ static char default_request[] = "Connection: close\r\n" "\r\n"; -static void -dsleep(double t) -{ - if (t > 100.0) - (void)sleep((int)round(t)); - else - (void)usleep((int)round(t * 1e6)); -} - /*-------------------------------------------------------------------- * Poke one backend, once, but possibly at both IPv4 and IPv6 addresses. * @@ -330,7 +321,7 @@ vbp_wrk_poll_backend(void *priv) vt->last, vt->avg, vt->resp_buf); if (!vt->stop) - dsleep(vt->probe.interval); + TIM_sleep(vt->probe.interval); } return (NULL); } diff --git a/varnish-cache/include/libvarnish.h b/varnish-cache/include/libvarnish.h index e250c33b..a7ddb470 100644 --- a/varnish-cache/include/libvarnish.h +++ b/varnish-cache/include/libvarnish.h @@ -70,6 +70,7 @@ void TIM_format(double t, char *p); time_t TIM_parse(const char *p); double TIM_mono(void); double TIM_real(void); +void TIM_sleep(double t); /* from libvarnish/version.c */ void varnish_version(const char *); diff --git a/varnish-cache/lib/libvarnish/time.c b/varnish-cache/lib/libvarnish/time.c index 0f2cce7d..37025649 100644 --- a/varnish-cache/lib/libvarnish/time.c +++ b/varnish-cache/lib/libvarnish/time.c @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include "config.h" #include "libvarnish.h" @@ -148,6 +150,16 @@ TIM_parse(const char *p) return (0); } +void +TIM_sleep(double t) +{ + if (t > 100.0) + (void)sleep((int)round(t)); + else + (void)usleep((int)round(t * 1e6)); +} + + #ifdef TEST_DRIVER #include