forked from enlightenment/efl
eina - thread naming - when naming thread, cut off at 15 chars
automatically cut off at 15 chars (and add 0 byte) to ensure we get a name, but just truncate it if it is too long.
This commit is contained in:
parent
5625aac4d4
commit
350698bada
|
@ -174,7 +174,14 @@ EAPI Eina_Bool
|
|||
eina_thread_name_set(Eina_Thread t, const char *name)
|
||||
{
|
||||
#ifdef EINA_HAVE_PTHREAD_SETNAME
|
||||
if (pthread_setname_np((pthread_t)t, name) == 0) return EINA_TRUE;
|
||||
char buf[16];
|
||||
if (name)
|
||||
{
|
||||
strncpy(buf, name, 15);
|
||||
buf[15] = 0;
|
||||
}
|
||||
else buf[0] = 0;
|
||||
if (pthread_setname_np((pthread_t)t, buf) == 0) return EINA_TRUE;
|
||||
#endif
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue