Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

At least on Linux, it's definitely possible with prctl(2):

    PR_SET_NAME
         Set the name of the calling thread, using the value in the
         location pointed to by name.

         The name can be up to 16 bytes long, including the
         terminating null byte.  If the length of the string,
         including the terminating null byte, exceeds 16 bytes, the
         string is silently truncated.


I was talking about Windows, given the context of TFA. You can also name threads in Windows. Especially in background applications, however, the initial main thread may not exist for the whole duration of the process (e.g. consider pthread_exit), so I’m not sure how practical that approach would be.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: