MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / JoinThreadWithTimeout

Function JoinThreadWithTimeout

src/platform/win/cloud_intercept.cpp:6570–6582  ·  view source on GitHub ↗

Bounded join used at shutdown so a wedged worker can't keep Steam alive. Timeout detaches; the OS reaps at process exit.

Source from the content-addressed store, hash-verified

6568// Bounded join used at shutdown so a wedged worker can't keep Steam alive.
6569// Timeout detaches; the OS reaps at process exit.
6570static bool JoinThreadWithTimeout(std::thread& t, DWORD timeoutMs, const char* name) {
6571 if (!t.joinable()) return true;
6572 HANDLE h = static_cast<HANDLE>(t.native_handle());
6573 DWORD wait = WaitForSingleObject(h, timeoutMs);
6574 if (wait == WAIT_OBJECT_0) {
6575 t.join();
6576 return true;
6577 }
6578 LOG("Shutdown: %s did not finish within %u ms (wait=%u) -- detaching to unblock shutdown",
6579 name, timeoutMs, wait);
6580 t.detach();
6581 return false;
6582}
6583
6584// IAT rewrite of every module's kernel32!ExitProcess slot; wrapper runs
6585// cooperative Shutdown then chains the original.

Callers 1

ShutdownImplFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected