File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,14 @@ void utils::exit(int status_code) {
196196// inspired by SDL_SYS_SetupThread also uses that code for most platforms
197197OOPETRIS_GRAPHICS_EXPORTED void utils::set_thread_name (const char * name) {
198198
199- #if defined(__APPLE__) || defined(__linux__) || defined(__ANDROID__) || defined(FLATPAK_BUILD)
199+ #if defined(__APPLE__) || defined(__MACOSX__)
200+ if (pthread_setname_np (name) == ERANGE) {
201+ char namebuf[16 ] = {}; /* Limited to 16 chars (with 0 byte) */
202+ memcpy (namebuf, name, 15 );
203+ namebuf[15 ] = ' \0 ' ;
204+ pthread_setname_np (namebuf);
205+ }
206+ #elif defined(__linux__) || defined(__ANDROID__) || defined(FLATPAK_BUILD)
200207 if (pthread_setname_np (pthread_self (), name) == ERANGE) {
201208 char namebuf[16 ] = {}; /* Limited to 16 chars (with 0 byte) */
202209 memcpy (namebuf, name, 15 );
You can’t perform that action at this time.
0 commit comments