]> git.ipfire.org Git - thirdparty/squid.git/blob - lib/xusleep.c
Source Format Enforcement (#532)
[thirdparty/squid.git] / lib / xusleep.c
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10 #include "xusleep.h"
11
12 #if HAVE_UNISTD_H
13 #include <unistd.h>
14 #endif
15
16 /**
17 * xusleep, as usleep but accepts longer pauses
18 */
19 int
20 xusleep(unsigned int usec)
21 {
22 /* XXX emulation of usleep() */
23 struct timeval sl;
24 sl.tv_sec = usec / 1000000;
25 sl.tv_usec = usec % 1000000;
26 return select(0, NULL, NULL, NULL, &sl);
27 }
28