discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread setName idea


From: Ivan Vučica
Subject: Re: NSThread setName idea
Date: Tue, 22 Apr 2014 11:58:44 +0100

You probably did not mean to check for the OS in a switch-case, then have the same code in the "darwin*)" branch and in the default "*)" branch. Just remove the case statement and leave AC_DEFINE() by itself.

Did you really mean to pollute the global namespace with 'void SetThreadName()'? You should probably use the 'static' qualifier here.

When calling PTHREAD_SETNAME(), you use a tab instead of two spaces for indentation. Same for the SetThreadName() body and the struct tagTHREADNAME_INFO body. (And it seems that the same applies to configure.ac.) Please use two spaces for indentation.


...we really need a proper code review system :-)

On Tue Apr 22 2014 at 7:30:01 AM, Lundberg, Johannes <johannes@brilliantservice.co.jp> wrote:
Hi

Thanks for the pointers, Richard. I have a made some changes that seem to work well on FreeBSD.
I tried to cover Linux, Mac OS X and Windows as well but those require testing.

I'm quite new with autoconf and I don't know if this is the way to do it so I would appreciate some feedback if someone want to take a look at my patch (attached in this mail).

Best regards


--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Mon, Apr 21, 2014 at 2:04 PM, Richard Frith-Macdonald <richardfrithmacdonald@gmail.com> wrote:

On 21 Apr 2014, at 05:44, "Lundberg, Johannes" <johannes@brilliantservice.co.jp> wrote:

> Hi
>
> Is each NSThread object backed by a pthread?

Yes.

> If so, would it be possible to have NSThread's setName also do
> pthread_set_name_np(..., ...)
> so that "top" etc also would show the thread name?
>
> I think I will try to do this anyway for my own debugging purposes. If you like I can submit a patch later.

That sounds like an excellent idea.

The  _np suffix in the function name (pthread_set_name_np) suggests that it's a non-standard addition to the pthreads API, so the presence/absence of the function would need to be tested at configure time in order to make such functionality portable to all the systems gnustrep runs on.

I found this article which suggests it should work in some way for linux/bsd systems: http://stackoverflow.com/questions/2369738/can-i-set-the-name-of-a-thread-in-pthreads-linux and also this one for windows http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message._______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

reply via email to

[Prev in Thread] Current Thread [Next in Thread]