Here is a new version that works better.. Have to make sure that pthread_set_name_np is called from the correct thread which is now done by using performSelector on thread self.
Still haven't tested on Linux, Windows or Mac though... -- Johannes Lundberg BRILLIANTSERVICE CO., LTD. On Tue, Apr 22, 2014 at 10:39 PM, Ivan Vučica <[email protected]> wrote: > Re: difference on Mac -- ah. :-) > > Generally LGTM, just make sure to follow the (bizarre as it may be) GNU > coding style. That does include a bit more than just tabs-vs-spaces (now I > spotted indentation differences involving for loops). > > Although, for a short patch, that isn't a problem to fix when someone > integrates it. > > sent from phone > On Apr 22, 2014 2:32 PM, "Lundberg, Johannes" < > [email protected]> wrote: > >> Hi! Thanks for the feedback. >> >> Look carefully, it's not the same code for Darwin. Mac takes only one >> argument for setname. >> >> The windows code is just copy/paste from the link I got. I wasn't >> sure where to put it really. Static is a good idea :) >> >> Two spaces, got it! >> >> Hope someone with access to Windows can test it also.. >> >> Otherwise, if this approach is ok I will clean up the patch and resubmit >> it. >> >> On Tuesday, April 22, 2014, Ivan Vučica <[email protected]> wrote: >> >>> 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 < >>> [email protected]> 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 < >>>> [email protected]> wrote: >>>> >>>>> >>>>> On 21 Apr 2014, at 05:44, "Lundberg, Johannes" < >>>>> [email protected]> 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/quest >>>>> ions/2369738/can-i-set-the-name-of-a-thread-in-pthreads-linux and >>>>> also this one for windows http://msdn.microsoft.com/en-u >>>>> s/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 >>>> [email protected] >>>> https://lists.gnu.org/mailman/listinfo/discuss-gnustep >>>> >>> >> >> -- >> -- >> Johannes Lundberg >> BRILLIANTSERVICE CO., LTD. >> >> >> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- >> 秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。 >> もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、 >> 複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。 >> --- >> 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. > > -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。 もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、 複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。 --- 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.
pthread_name.patch
Description: Binary data
_______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
