Commit 3f3f27f3 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Move dsleep to libvarnish/time.c and rename it to TIM_sleep


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3260 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 68590235
......@@ -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);
}
......
......@@ -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 *);
......
......@@ -53,6 +53,8 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#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 <stdlib.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment