77 tmp[
sizeof tmp - 1] =
'\0';
78 strncpy(tmp, prog_name,
sizeof tmp - 1);
80 strncat(tmp,
name,
sizeof tmp - strlen(tmp) - 1);
81 pthread_setname_np(pthread_self(), tmp);
82#elif defined __APPLE__
84 char *tmp = (
char *) alloca(strlen(prog_name) + strlen(
name) + 1);
85 strcpy(tmp, prog_name);
88 pthread_setname_np(tmp);
91#ifdef HAVE_SETTHREADDESCRIPTION
93 size_t dst_len = (mbstowcs(NULL, prog_name, 0) + mbstowcs(NULL,
name, 0) + 1) *
sizeof(
wchar_t);
94 wchar_t *tmp = (
wchar_t *) alloca(dst_len);
95 mbstowcs(tmp, prog_name, dst_len /
sizeof(
wchar_t));
96 mbstowcs(tmp + wcslen(tmp),
name, dst_len /
sizeof(
wchar_t) - wcslen(tmp));
97 SetThreadDescription(GetCurrentThread(), tmp);