MCPcopy Create free account
hub / github.com/defold/defold / SetThreadName

Function SetThreadName

engine/profiler/src/basic/profiler_basic.cpp:581–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579// Listener api
580
581static ProfileResult SetThreadName(void* ctx, const char* name)
582{
583 (void)ctx;
584 PropertyInitialize();
585 CHECK_INITIALIZED_RETVAL(PROFILE_RESULT_NOT_INITIALIZED);
586 DM_MUTEX_SCOPED_LOCK(g_Lock);
587 int32_t thread_id = GetThreadId();
588 const char** existing = g_ProfileContext->m_ThreadNames.Get(thread_id);
589 if (existing)
590 {
591 free((void*)*existing);
592 }
593
594 if (g_ProfileContext->m_ThreadNames.Full())
595 {
596 uint32_t cap = g_ProfileContext->m_ThreadNames.Capacity() + 32;
597 g_ProfileContext->m_ThreadNames.SetCapacity((cap * 2) / 3, cap);
598 }
599 g_ProfileContext->m_ThreadNames.Put(thread_id, strdup(name));
600 return PROFILE_RESULT_OK;
601}
602
603static void* CreateListener()
604{

Callers 1

CreateListenerFunction · 0.70

Calls 8

freeFunction · 0.85
PropertyInitializeFunction · 0.70
GetThreadIdFunction · 0.70
GetMethod · 0.45
FullMethod · 0.45
CapacityMethod · 0.45
SetCapacityMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected