Use pthread_setname_np result instead of errno.

Fixes setting thread name on platforms where errno is not set.
This commit is contained in:
Frederik Seiffert 2020-03-17 14:27:06 +01:00
parent 95abcbd694
commit a3b8ea0937
2 changed files with 7 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2020-03-17 Frederik Seiffert <frederik@algoriddim.com>
* Source/NSThread.m: Use pthread_setname_np result instead of errno,
which fixes setting thread name on platforms where errno is not set.
2020-03-12 Fred Kiefer <fredkiefer@gmx.de>
* Source/NSURL.m: Fix compiler warnigns.

View file

@ -1241,12 +1241,7 @@ unregisterActiveThread(NSThread *thread)
}
while (i > 0)
{
if (PTHREAD_SETNAME(buf) == 0)
{
break; // Success
}
if (ERANGE == errno)
if (PTHREAD_SETNAME(buf) == ERANGE)
{
/* Name must be too long ... gnu/linux uses 15 characters
*/
@ -1274,7 +1269,7 @@ unregisterActiveThread(NSThread *thread)
}
else
{
break; // Some other error
break; // Success or some other error
}
}
}