mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
fixes osx/ios set thread name (#284)
This commit is contained in:
@@ -72,6 +72,7 @@ namespace bx
|
||||
uint32_t m_stackSize;
|
||||
int32_t m_exitCode;
|
||||
bool m_running;
|
||||
char m_name[32];
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
@@ -132,6 +132,15 @@ namespace bx
|
||||
m_userData = _userData;
|
||||
m_stackSize = _stackSize;
|
||||
|
||||
if (NULL != _name)
|
||||
{
|
||||
strCopy(m_name, sizeof(m_name), _name);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_name[0] = '\0';
|
||||
}
|
||||
|
||||
ThreadInternal* ti = (ThreadInternal*)m_internal;
|
||||
#if BX_CRT_NONE
|
||||
ti->m_handle = crt0::threadCreate(&ti->threadFunc, _userData, m_stackSize, _name);
|
||||
@@ -190,11 +199,6 @@ namespace bx
|
||||
m_running = true;
|
||||
m_sem.wait();
|
||||
|
||||
if (NULL != _name)
|
||||
{
|
||||
setThreadName(_name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -316,6 +320,7 @@ namespace bx
|
||||
#endif // BX_PLATFORM_WINDOWS
|
||||
|
||||
m_sem.post();
|
||||
setThreadName(m_name);
|
||||
int32_t result = m_fn(this, m_userData);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user