I think the pthread_set_name_np(3) function is for debugging (reporting) purposes.
It is.
The names show up when you use 'procstat', 'top', 'ps', etc.
If you want to give a thread a name and use that name later in code why not keep that internally in you thread management structures/code and use that same name in the call to pthread_set_name_np?
I cannot speak for him, but sometimes it is easier to just let the OS do stuff for you. That being said, if that is what he wants, it would be trivial to do using thread specific data:
https://docs.oracle.com/cd/E19120-01/open.solaris/816-5137/tlib-40012/index.html
The GNU extension is just a special case of TSD that was implemented to aid debugging as far as I can tell. It is separate from the pthreads functionality for implementing this though.
ManiaC++
Jan Knepper
Hi,
for setting a name for pthreads i found pthread_set_name_np(3), but for retrieving the name i found nothing. Is there any api like pthread_getname_np for FreeBSD? Or is there another way to retrieve the threads name within an application?
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers