MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / SetName

Method SetName

Sources/nCine/Threading/Thread.cpp:387–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385 }
386
387 void Thread::SetName(const char* name)
388 {
389 if (_sharedBlock == nullptr || _sharedBlock->_handle == 0) {
390 return;
391 }
392
393#if defined(DEATH_TARGET_WINDOWS)
394 SetThreadName(_sharedBlock->_handle, name);
395#elif !defined(DEATH_TARGET_APPLE) && !defined(DEATH_TARGET_EMSCRIPTEN) && !defined(DEATH_TARGET_SWITCH)
396 const auto nameLength = strnlen(name, MaxThreadNameLength);
397 if (nameLength <= MaxThreadNameLength - 1) {
398 pthread_setname_np(_sharedBlock->_handle, name);
399 } else {
400 char buffer[MaxThreadNameLength];
401 memcpy(buffer, name, MaxThreadNameLength - 1);
402 buffer[MaxThreadNameLength - 1] = '\0';
403 pthread_setname_np(_sharedBlock->_handle, name);
404 }
405#endif
406 }
407
408 void Thread::SetCurrentName(const char* name)
409 {

Callers

nothing calls this directly

Calls 1

SetThreadNameFunction · 0.70

Tested by

no test coverage detected