Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2018 13:49:54 -0400
From:      Jan Knepper <jan@digitaldaemon.com>
To:        Richard Yao <ryao@gentoo.org>
Cc:        =?UTF-8?Q?Manuel_St=c3=bchn?= <freebsdnewbie@freenet.de>, freebsd-hackers@freebsd.org
Subject:   Re: Getting pthread names
Message-ID:  <e1549253-833c-fc5f-12ef-5eaf352badb8@digitaldaemon.com>
In-Reply-To: <64966B3E-41FE-44A5-A85D-A96EF89B22ED@gentoo.org>
References:  <20180430111434.GA18085@freebsd-t450.fritz.box> <7d26b9d2-0f1e-2103-941a-c9c608b4e4fa@digitaldaemon.com> <64966B3E-41FE-44A5-A85D-A96EF89B22ED@gentoo.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04/30/2018 10:53, Richard Yao wrote:
>
>
> On Apr 30, 2018, at 10:24 AM, Jan Knepper <jan@digitaldaemon.com 
> <mailto:jan@digitaldaemon.com>> wrote:
>
>> 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:
My experience as a software engineer is... If the OS or (standard) 
library can do something for you, let the OS or (standard) library do 
it. So, agreed.

It is also 'trivial' to do when you have any form or thread management 
or any form of thread data. Indeed using a 'thread specific data' 
solution might be helpful.
>
>>
>> On 04/30/2018 07:14, Manuel Stühn wrote:
>>> 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?
>>>
>>> _______________________________________________
>>
ManiaC++
Jan Knepper




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e1549253-833c-fc5f-12ef-5eaf352badb8>