public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Thomas Rodgers <rodgert@appliantology.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org,
	Thomas Rodgers <trodgers@redhat.com>
Subject: Re: [PATCH] Add support for C++20 barriers
Date: Sun, 24 May 2020 19:55:00 +0200	[thread overview]
Message-ID: <87367p1amj.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <345C7AA7-5DC8-4A9E-9B6B-30A73645F85C@appliantology.com> (Thomas Rodgers's message of "Sun, 24 May 2020 10:42:12 -0700")

* Thomas Rodgers:

> +      static __gthread_t
> +      _S_get_tid() noexcept
> +      {
> +#ifdef __GLIBC__
> +	// For the GNU C library pthread_self() is usable without linking to
> +	// libpthread.so but returns 0, so we cannot use it in single-threaded
> +	// programs, because this_thread::get_id() != thread::id{} must be true.
> +	// We know that pthread_t is an integral type in the GNU C library.
> +	if (!__gthread_active_p())
> +	  return 1;
> +#endif
> +	return __gthread_self();
> +      }

This comment seems outdated or incomplete.  pthread_self returns a
proper pointer since glibc 2.27, I believe.

I'm also not sure how the difference is observable for the libstdc++
implementation.  Late loading of libpthread isn't quite supported.

  reply	other threads:[~2020-05-24 17:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 22:58 Thomas Rodgers
2020-05-24 17:42 ` Thomas Rodgers
2020-05-24 17:55   ` Florian Weimer [this message]
2020-05-24 18:11     ` Jonathan Wakely
2020-05-24 18:15       ` Florian Weimer
2020-05-24 21:37       ` Thomas Rodgers
2020-06-06 21:25 Thomas Rodgers
2020-09-07 23:34 Thomas Rodgers

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=87367p1amj.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=rodgert@appliantology.com \
    --cc=trodgers@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).