Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2018 10:53:26 -0400
From:      Richard Yao <ryao@gentoo.org>
To:        Jan Knepper <jan@digitaldaemon.com>
Cc:        =?utf-8?Q?Manuel_St=C3=BChn?= <freebsdnewbie@freenet.de>, freebsd-hackers@freebsd.org
Subject:   Re: Getting pthread names
Message-ID:  <64966B3E-41FE-44A5-A85D-A96EF89B22ED@gentoo.org>
In-Reply-To: <7d26b9d2-0f1e-2103-941a-c9c608b4e4fa@digitaldaemon.com>
References:  <20180430111434.GA18085@freebsd-t450.fritz.box> <7d26b9d2-0f1e-2103-941a-c9c608b4e4fa@digitaldaemon.com>

next in thread | previous in thread | raw e-mail | index | archive | help


> On Apr 30, 2018, at 10:24 AM, Jan Knepper <jan@digitaldaemon.com> wrote:
>=20
> I think the pthread_set_name_np(3) function is for debugging (reporting) p=
urposes.

It is.
>=20
> The names show up when you use 'procstat', 'top', 'ps', etc.
>=20
> If you want to give a thread a name and use that name later in code why no=
t 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 stu=
ff for you. That being said, if that is what he wants, it would be trivial t=
o 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 d=
ebugging as far as I can tell. It is separate from the pthreads functionalit=
y for implementing this though.
>=20
> ManiaC++
> Jan Knepper
>=20
>=20
>=20
>> On 04/30/2018 07:14, Manuel St=C3=BChn wrote:
>> Hi,
>>=20
>> for setting a name for pthreads i found pthread_set_name_np(3), but for r=
etrieving 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?
>>=20
>> _______________________________________________
>> freebsd-hackers@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org=
"
>=20
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"=




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?64966B3E-41FE-44A5-A85D-A96EF89B22ED>