mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 18:25:36 +00:00
Linux thread name limitation: test for ERANGE (see bug #5283)
This commit is contained in:
parent
daea9fa19e
commit
87b02d3795
|
@ -137,18 +137,22 @@ SDL_SYS_SetupThread(const char *name)
|
|||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
ppthread_setname_np(name);
|
||||
#elif defined(__LINUX__)
|
||||
if (ppthread_setname_np(pthread_self(), name) == ERANGE) {
|
||||
char namebuf[16]; /* Limited to 16 char */
|
||||
SDL_strlcpy(namebuf, name, sizeof (namebuf));
|
||||
ppthread_setname_np(pthread_self(), namebuf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#elif HAVE_PTHREAD_SETNAME_NP
|
||||
#if defined(__NETBSD__)
|
||||
pthread_setname_np(pthread_self(), "%s", name);
|
||||
#else
|
||||
if (pthread_setname_np(pthread_self(), name) == ERANGE) {
|
||||
char namebuf[16]; /* Limited to 16 char */
|
||||
SDL_strlcpy(namebuf, name, sizeof (namebuf));
|
||||
pthread_setname_np(pthread_self(), namebuf);
|
||||
}
|
||||
#endif
|
||||
#elif HAVE_PTHREAD_SET_NAME_NP
|
||||
pthread_set_name_np(pthread_self(), name);
|
||||
|
|
Loading…
Reference in a new issue