MCPcopy Create free account
hub / github.com/Niko1221/Strata / name_this_thread

Function name_this_thread

engine/src/kernels/cpu/pool.cpp:1889–1901  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1887// (Windows 10 1607 and later) is looked up, not linked: older SDKs and toolchains lack the import.
1888namespace strata::platform {
1889void name_this_thread(const char* base, int index) {
1890 char name[64];
1891 if (index >= 0) std::snprintf(name, sizeof name, "%s-%d", base, index);
1892 else std::snprintf(name, sizeof name, "%s", base);
1893 using SetDesc = HRESULT(WINAPI*)(HANDLE, PCWSTR);
1894 static const SetDesc fn = (SetDesc) GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetThreadDescription");
1895 if (fn == nullptr) return;
1896 wchar_t wide[64];
1897 int i = 0;
1898 for (; name[i] != '\0' && i < 63; ++i) wide[i] = (wchar_t) (unsigned char) name[i];
1899 wide[i] = L'\0';
1900 (void) fn(GetCurrentThread(), wide);
1901}
1902} // namespace strata::platform
1903#endif

Callers 11

ExpertPoolMethod · 0.70
io_workerMethod · 0.50
startMethod · 0.50
ram_workerMethod · 0.50
fill_loopMethod · 0.50
initMethod · 0.50
ExpertPoolMethod · 0.50
HandWorkerMethod · 0.50
initMethod · 0.50
prefill.cppFile · 0.50
run_cyclicMethod · 0.50

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected