+++ /dev/null
-/*
- * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#ifndef _INC_XUSLEEP_H
-#define _INC_XUSLEEP_H
-
-SQUIDCEXTERN int xusleep(unsigned int);
-
-#endif /* _INC_XUSLEEP_H */
-
getfullhostname.c \
heap.c \
radix.c \
- util.c \
- xusleep.c
+ util.c
TESTS += tests/testRFC1738
+++ /dev/null
-/*
- * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#include "squid.h"
-#include "xusleep.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/**
- * xusleep, as usleep but accepts longer pauses
- */
-int
-xusleep(unsigned int usec)
-{
- /* XXX emulation of usleep() */
- struct timeval sl;
- sl.tv_sec = usec / 1000000;
- sl.tv_usec = usec % 1000000;
- return select(0, NULL, NULL, NULL, &sl);
-}
-
#include "debug/Stream.h"
#include "sbuf/Stream.h"
#include "tools.h"
-#include "xusleep.h"
+#include <chrono>
+#include <thread>
#include <utility>
#if HAVE_FCNTL_H
" more time(s) after a failure: " << ex.what());
}
Must(attemptsLeft); // the catch statement handles the last attempt
- xusleep(cfg.RetryGapUsec);
+ std::this_thread::sleep_for(std::chrono::microseconds(cfg.RetryGapUsec));
}
debugs(54, 9, "disabled");
}
processes, these sleep delays will add up and your
Squid will not service requests for some amount of time
until all the child processes have been started.
- On Windows value less then 1000 (1 milliseconds) are
- rounded to 1000.
DOC_END
NAME: windows_ipaddrchangemonitor
#include "SquidIpc.h"
#include "tools.h"
+#include <chrono>
+#include <thread>
+
static const char *hello_string = "hi there\n";
#ifndef HELLO_BUF_SZ
#define HELLO_BUF_SZ 32
fd_table[pwfd].flags.ipc = 1;
- if (Config.sleep_after_fork) {
- /* XXX emulation of usleep() */
-
- struct timeval sl;
- sl.tv_sec = Config.sleep_after_fork / 1000000;
- sl.tv_usec = Config.sleep_after_fork % 1000000;
- select(0, nullptr, nullptr, nullptr, &sl);
- }
+ if (Config.sleep_after_fork)
+ std::this_thread::sleep_for(std::chrono::microseconds(Config.sleep_after_fork));
return pid;
}
#include "tools.h"
#include <cerrno>
+#include <chrono>
+#include <thread>
+
#if HAVE_MSWSOCK_H
#include <mswsock.h>
#endif
fd_table[crfd].flags.ipc = true;
fd_table[cwfd].flags.ipc = true;
- if (Config.sleep_after_fork) {
- /* XXX emulation of usleep() */
- DWORD sl;
- sl = Config.sleep_after_fork / 1000;
-
- if (sl == 0)
- sl = 1;
-
- Sleep(sl);
- }
+ if (Config.sleep_after_fork)
+ std::this_thread::sleep_for(std::chrono::microseconds(Config.sleep_after_fork));
if (GetExitCodeThread((HANDLE) thread, &ecode) && ecode == STILL_ACTIVE) {
if (hIpc)
#include "store/Disk.h"
#include "tools.h"
#include "unlinkd.h"
-#include "xusleep.h"
+
+#include <chrono>
+#include <thread>
/* This code gets linked to Squid */
* We can't use fd_set when using epoll() or kqueue(). In
* these cases we block for 10 ms.
*/
- xusleep(10000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
#else
/*
* DPW 2007-04-23
if (pid < 0)
fatal("Failed to create unlinkd subprocess");
- xusleep(250000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(250));
fd_note(unlinkd_wfd, "squid -> unlinkd");