MCPcopy Create free account
hub / github.com/alecazam/kram / getThreadName

Function getThreadName

libkram/kram/TaskSystem.cpp:299–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void getThreadName(std::thread::native_handle_type threadHandle, char name[kMaxThreadName])
300{
301 name[0] = 0;
302
303 wchar_t* threadNameW = nullptr;
304 HRESULT hr = ::GetThreadDescription(threadHandle, &threadNameW);
305 if (SUCCEEDED(hr)) {
306 // convert name back
307 uint32_t len = wcslen(threadNameW);
308 if (len > kMaxThreadName)
309 len = kMaxThreadName;
310 for (uint32_t i = 0; i < len; ++i) {
311 name[i] = (char)threadNameW[i];
312 }
313 name[kMaxThreadName - 1] = 0;
314
315 LocalFree(threadNameW);
316 }
317}
318
319#elif KRAM_APPLE
320

Callers 2

getCurrentThreadNameFunction · 0.85
addThreadIfNeededMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected