Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Spencer <maillist-gdbpatches@barfooze.de>
To: Kai Tietz <ktietz70@googlemail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: wrong assumptions about pthread_t being numeric
Date: Sat, 01 Oct 2011 01:08:00 -0000	[thread overview]
Message-ID: <4E86676A.7060706@barfooze.de> (raw)
In-Reply-To: <CAEwic4YUN78ATPxSz8tC1_xq4aeV-XbQ_ufGGW9GEWn4k3cTzw@mail.gmail.com>

On 09/29/2011 10:26 AM, Kai Tietz wrote:
>
> 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) == sizeof (void *), which is a broken
> attempt.  It might be a way to use here instead intptr_t instead of
> long type.

gdb assumes that the type of thread_t is a long. that is the bogus part.
my macro just explicitly casts it to long. on archictectures where 
sizeof(void*) != sizeof(long) it would possible truncate or zeropad the 
value, but still return a (hopefully unique) number.
if it isnt guaranteed to return a unique number on this not-yet-existing 
platform, there had to be some ifdef'd code for that.
for libc's that use a struct type for pthread_t, there needs to be a 
specific workarounds, as others already pointed out.

> 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
>


  reply	other threads:[~2011-10-01  1:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16 23:01 John Spencer
2011-09-16 23:16 ` Pedro Alves
2011-09-17  0:31   ` John Spencer
2011-09-17  1:05     ` Pedro Alves
2011-09-17  1:23       ` John Spencer
2011-09-17  2:29         ` Matt Rice
2011-09-17  6:47         ` Joel Brobecker
2011-09-18  0:11           ` John Spencer
2011-09-29  2:31             ` John Spencer
2011-09-29  8:39               ` Kai Tietz
2011-10-01  1:08                 ` John Spencer [this message]
2011-09-29 11:10               ` Pedro Alves
2011-09-17 15:29         ` Pedro Alves
2011-09-17 15:47           ` Pedro Alves
2011-10-01  1:02             ` John Spencer
2011-10-01  2:00               ` Pedro Alves
2011-10-01  9:00                 ` Mark Kettenis
2011-10-01  9:14                   ` Kevin Pouget
2011-10-05  8:02                 ` John Spencer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E86676A.7060706@barfooze.de \
    --to=maillist-gdbpatches@barfooze.de \
    --cc=gdb-patches@sourceware.org \
    --cc=ktietz70@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox