refactor: replace ARCH->sleep(...) calls with Arch::sleep(...)

This commit is contained in:
sithlord48
2025-06-15 20:13:25 -04:00
committed by Nick Bolton
parent 84e289bc30
commit 5fd4d93f7f
12 changed files with 19 additions and 19 deletions

View File

@ -424,7 +424,7 @@ bool ArchMultithreadPosix::wait(ArchThread target, double timeout)
const double start = Arch::time();
do {
// wait a little
ARCH->sleep(0.05);
Arch::sleep(0.05);
// repeat test
testCancelThreadImpl(self);

View File

@ -63,7 +63,7 @@ static in_addr_t inet_aton(const char *cp, struct in_addr *inp)
void ArchNetworkBSD::Deps::sleep(double seconds)
{
ARCH->sleep(seconds);
Arch::sleep(seconds);
}
int ArchNetworkBSD::Deps::poll(struct pollfd *fds, nfds_t nfds, int timeout)

View File

@ -169,7 +169,7 @@ void ArchDaemonWindows::uninstallDaemon(const char *name)
// give windows a chance to remove the service before we check if it still exists.
// 100ms should be plenty of time.
LOG_DEBUG("waiting for service to be removed");
ARCH->sleep(0.1);
Arch::sleep(0.1);
// handle failure. ignore error if service isn't installed anymore.
if (!okay && isDaemonInstalled(name)) {

View File

@ -101,7 +101,7 @@ int App::run(int argc, char **argv)
// display invalid exceptions can occur when going to sleep. When this
// process exits, the UI will restart us instantly. We don't really want
// that behevior, so we quies for a bit
ARCH->sleep(10);
Arch::sleep(10);
} catch (std::runtime_error &re) {
LOG((CLOG_CRIT "a runtime error occurred: %s\n", re.what()));
} catch (std::exception &e) {

View File

@ -436,7 +436,7 @@ int SecureSocket::secureAccept(int socket)
LOG((CLOG_ERR "failed to accept secure socket"));
LOG((CLOG_WARN "client connection may not be secure"));
m_secureReady = false;
ARCH->sleep(1);
Arch::sleep(1);
retry = 0;
return -1; // Failed, error out
}
@ -459,7 +459,7 @@ int SecureSocket::secureAccept(int socket)
if (retry > 0) {
LOG((CLOG_DEBUG2 "retry accepting secure socket"));
m_secureReady = false;
ARCH->sleep(s_retryDelay);
Arch::sleep(s_retryDelay);
return 0;
}
@ -507,7 +507,7 @@ int SecureSocket::secureConnect(int socket)
if (retry > 0) {
LOG((CLOG_DEBUG2 "retry connect secure socket"));
m_secureReady = false;
ARCH->sleep(s_retryDelay);
Arch::sleep(s_retryDelay);
return 0;
}

View File

@ -1387,7 +1387,7 @@ void MSWindowsScreen::warpCursorNoFlush(int32_t x, int32_t y)
// chance of undesired behavior. we'll also check for very
// large motions that look suspiciously like about half width
// or height of the screen.
ARCH->sleep(0.0);
Arch::sleep(0.0);
// send an event that we can recognize after the mouse warp
PostThreadMessage(GetCurrentThreadId(), DESKFLOW_MSG_POST_WARP, 0, 0);

View File

@ -213,7 +213,7 @@ void MSWindowsScreenSaver::watchDesktopThread(void *)
for (;;) {
// wait a bit
ARCH->sleep(0.2);
Arch::sleep(0.2);
BOOL running;
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &running, 0);

View File

@ -241,7 +241,7 @@ void MSWindowsWatchdog::mainLoop(void *)
// Sleep for only 100ms rather than 1 second so that the service can shut down faster.
LOG_DEBUG3("watchdog main loop sleeping");
ARCH->sleep(0.1);
Arch::sleep(0.1);
}
LOG_DEBUG("watchdog main loop finished");
@ -309,7 +309,7 @@ void MSWindowsWatchdog::startProcess()
} else {
// Wait for program to fail. This needs to be 1 second, as the process may take some time to fail.
LOG_DEBUG("watchdog waiting for process start result");
ARCH->sleep(1);
Arch::sleep(1);
if (!isProcessRunning()) {
m_process.reset();
@ -357,7 +357,7 @@ void MSWindowsWatchdog::outputLoop(void *)
if (!success || bytesRead == 0) {
// Sleep for only 100ms rather than 1 second so that the service can shut down faster.
ARCH->sleep(0.1);
Arch::sleep(0.1);
} else {
buffer[bytesRead] = '\0';
@ -524,7 +524,7 @@ void MSWindowsWatchdog::sasLoop(void *) // NOSONAR - Thread entry point signatur
while (m_running) {
if (m_processState != ProcessState::Running) {
LOG_DEBUG2("watchdog not running, skipping SendSAS");
ARCH->sleep(1);
Arch::sleep(1);
continue;
}
@ -532,7 +532,7 @@ void MSWindowsWatchdog::sasLoop(void *) // NOSONAR - Thread entry point signatur
MSWindowsHandle sendSasEvent(CreateEvent(nullptr, FALSE, FALSE, kSendSasEventName));
if (sendSasEvent.get() == nullptr) {
LOG_ERR("could not create SAS event, error: %s", windowsErrorToString(GetLastError()).c_str());
ARCH->sleep(1);
Arch::sleep(1);
continue;
}

View File

@ -889,7 +889,7 @@ void OSXKeyState::setGroup(int32_t group)
// event queue and without a delay the subsequent key press
// event could be applied before the keyboard layout would
// actually be changed.
ARCH->sleep(.01);
Arch::sleep(.01);
}
void OSXKeyState::adjustAltGrModifier(const KeyIDs &ids, KeyModifierMask *mask, bool isCommand) const

View File

@ -1232,7 +1232,7 @@ bool XWindowsClipboard::CICCCMGetClipboard::readClipboard(
}
}
} else {
ARCH->sleep(0.01);
Arch::sleep(0.01);
}
}

View File

@ -1887,7 +1887,7 @@ bool XWindowsScreen::grabMouseAndKeyboard()
assert(result != GrabNotViewable);
if (result != GrabSuccess) {
LOG((CLOG_DEBUG2 "waiting to grab keyboard"));
ARCH->sleep(0.05);
Arch::sleep(0.05);
if (timer.getTime() >= s_timeout) {
LOG((CLOG_DEBUG2 "grab keyboard timed out"));
return false;
@ -1904,7 +1904,7 @@ bool XWindowsScreen::grabMouseAndKeyboard()
// back off to avoid grab deadlock
XUngrabKeyboard(m_display, CurrentTime);
LOG((CLOG_DEBUG2 "ungrabbed keyboard, waiting to grab pointer"));
ARCH->sleep(0.05);
Arch::sleep(0.05);
if (timer.getTime() >= s_timeout) {
LOG((CLOG_DEBUG2 "grab pointer timed out"));
return false;

View File

@ -116,7 +116,7 @@ void OSXKeyStateTests::fakePollCharWithModifier()
bool OSXKeyStateTests::isKeyPressed(const OSXKeyState &keyState, KeyButton button)
{
// HACK: allow os to realize key state changes.
ARCH->sleep(.2);
Arch::sleep(.2);
IKeyState::KeyButtonSet pressed;
keyState.pollPressedKeys(pressed);