From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13176 invoked by alias); 29 Sep 2011 08:27:02 -0000 Received: (qmail 13161 invoked by uid 22791); 29 Sep 2011 08:27:00 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Sep 2011 08:26:42 +0000 Received: by vcbfo14 with SMTP id fo14so296269vcb.0 for ; Thu, 29 Sep 2011 01:26:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.152.137 with SMTP id g9mr2880173vcw.48.1317284802073; Thu, 29 Sep 2011 01:26:42 -0700 (PDT) Received: by 10.220.180.5 with HTTP; Thu, 29 Sep 2011 01:26:42 -0700 (PDT) In-Reply-To: <4E83D50B.60002@barfooze.de> References: <4E73D06F.603@barfooze.de> <201109170000.43306.pedro@codesourcery.com> <4E73D806.2040302@barfooze.de> <201109170130.42276.pedro@codesourcery.com> <4E73F1A4.2020606@barfooze.de> <20110917022840.GD17681@adacore.com> <4E74C031.8050603@barfooze.de> <4E83D50B.60002@barfooze.de> Date: Thu, 29 Sep 2011 08:39:00 -0000 Message-ID: Subject: Re: wrong assumptions about pthread_t being numeric From: Kai Tietz To: John Spencer Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00508.txt.bz2 2011/9/29 John Spencer : > On 09/17/2011 05:43 PM, John Spencer wrote: >> >> On 09/17/2011 04:28 AM, Joel Brobecker wrote: >>>> >>>> i disagree. adding a proper solution once is superior to creating >>>> dozens of special case hacks. =A0also it saves a lot of time in the lo= ng >>>> term. >>> >>> Based on my experience so far, I have to agree with Pedro. >>> But if you do have a superior solution, we'll take a look. >>> I still have to tell you that I won't like it if your solution >>> makes the code harder to read. Sometimes, that's OK because it >>> helps achieving portability. =A0But when there is no such need for >>> portability, it just gets in the way. Let's also be pragmatic, >>> here and fix the problems that we know we have. >>> >> it would be nice to have an approach which would just work anywhere and >> respect the spec, >> however i currently have not the resources to implement it. >> >> thus, as you suggested, i came up with a small patch fixing the issue at >> hand. the solution should work on any sys/libc combination where >> sizeof(long) =3D=3D sizeof(void*) and pthread_t is either a pointer or a= n int >> with sizeof equal or less than sizeof long. >> this should cover all currently existing combinations. >> >> i may find more spots in the future which need the application of the >> macro, and will eventually be sending more patches applying the conversi= on >> macro to it. >> >> -- JS >> >> > > knock, knock. anybody here ? > please tell me wether you accept my patch or not. > > -- JS Well, I can't approve this and I won't. But I would like to give me 5 cents for this approach. This approach seems to me bogus, as you are dependent to sizeof (long) =3D=3D sizeof (void *), which is a broken attempt. It might be a way to use here instead intptr_t instead of long type. Nevertheless I admit that the pthread standard doesn't disallow structure-typed pthread_t, so it might be still worth to support this for gthread posix. For windows there is a pthread implementation "winpthread" - hosted by mingw-w64 project in experimental tree but it will be soon put into active trunk. This one uses here for pthread_t an integer-scalar handle instead of a structure, so issues about current implementation in gthread are working fine. Regards, Kai