mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-11-03 04:17:20 -05:00
Feature: Support pthread_setname_np()
This commit is contained in:
parent
04e4f7eb60
commit
85d54c53de
@ -314,6 +314,14 @@ thread_type *thread_create_c(const char *name, void *(*start_routine)(void *),
|
||||
if (pthread_create (&thread->sys_thread, &attr, _start_routine, start) == 0)
|
||||
{
|
||||
pthread_attr_destroy (&attr);
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
if (pthread_setname_np(thread->sys_thread, name) != 0) {
|
||||
/* If the call above did not work it was likely due to name limit restrictions.
|
||||
* In that case we retry with a fixed name so we do not inherit our parent's name.
|
||||
*/
|
||||
pthread_setname_np(thread->sys_thread, "Worker");
|
||||
}
|
||||
#endif
|
||||
return thread;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user