public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Thomas Rodgers <rodgert@appliantology.com>
Cc: David Edelsohn <dje.gcc@gmail.com>,
	Jakub Jelinek <jakub@redhat.com>,
	gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: GCC 11.1 Release Candidate available from gcc.gnu.org
Date: Wed, 21 Apr 2021 15:30:19 +0100	[thread overview]
Message-ID: <20210421143019.GY3008@redhat.com> (raw)
In-Reply-To: <20210421121218.GV3008@redhat.com>

On 21/04/21 13:12 +0100, Jonathan Wakely wrote:
>On 21/04/21 12:38 +0100, Jonathan Wakely wrote:
>>On 20/04/21 22:12 -0700, Thomas Rodgers wrote:
>>>@@ -86,6 +88,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>>	}
>>>   }
>>>
>>>+    _GLIBCXX_ALWAYS_INLINE bool
>>>+    _M_try_acquire() noexcept
>>>+    {
>>>+      for (;;)
>>>+	{
>>>+	  auto __err = sem_trywait(&_M_semaphore);
>>>+	  if (__err && (errno == EINTR))
>>>+	    continue;
>>>+	  else if (__err && (errno == EAGAIN))
>>>+	    return false;
>>>+	  else if (__err)
>>>+	    std::terminate();
>>>+	  else
>>>+	    break;
>>>+	}
>>>+      return true;
>>>+    }
>>>+
>>>   _GLIBCXX_ALWAYS_INLINE void
>>>   _M_release(std::ptrdiff_t __update) noexcept
>>>   {
>>
>>Please just commit this part to trunk and gcc-11, not the macro
>>renaming (as that's been fixed by Jakub already).
>
>I think on trunk I'd prefer to do the attached. WDYT?

In fact I think something like this is neded even on gcc-11 branch,
otherwise anything that tries to include <semaphore> without atomics
or sem_t gets hard errors:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100179

And <thread> includes <stop_token> which includes <semaphore>, meaning
<thread> is unusable on those targets.

So I think removing this #error is essential:
  
>-// Note: the _GLIBCXX_REQUIRE_POSIX_SEMAPHORE macro can be used to force the
>-// use of Posix semaphores (sem_t). Doing so however, alters the ABI.
>-#if defined __cpp_lib_atomic_wait && !_GLIBCXX_REQUIRE_POSIX_SEMAPHORE
>   using __semaphore_impl = __atomic_semaphore;
>-#elif _GLIBCXX_HAVE_POSIX_SEMAPHORE
>-  using __semaphore_impl = __platform_semaphore;
>-#else
>-#  error "No suitable semaphore implementation available"
>-#endif
>+#endif // __cpp_lib_atomic_wait


  parent reply	other threads:[~2021-04-21 14:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210420152439.GR1179226@tucnak>
     [not found] ` <CAGWvnykjEBYoK=poyfSWy84Eix__GJ-NJ50QSc99ji-UM8n+Wg@mail.gmail.com>
     [not found]   ` <6ac731c557415b46b04613d9b908df2f@appliantology.com>
     [not found]     ` <CAGWvnymcuXzvrBEm6rrTvXzRyoCYgx0vUm2nUBMWA29aQZc4uQ@mail.gmail.com>
     [not found]       ` <a69622f7cc24e6e311d5099b9899e798@appliantology.com>
     [not found]         ` <CAGWvnykWuuxtDKen5AXfX5k__UsChmvJAhp5-vC6O5LFnhqjBQ@mail.gmail.com>
     [not found]           ` <CAGWvnykNJ0VqcMcFfBrQUTTFOk_J2PVj2Ci5jNZu55sbnc7Y9w@mail.gmail.com>
     [not found]             ` <45de03629a536c0000c9b47bb79d6601@appliantology.com>
2021-04-21  8:56               ` Jakub Jelinek
2021-04-21  9:05                 ` Jonathan Wakely
2021-04-21 11:38               ` Jonathan Wakely
2021-04-21 12:12                 ` Jonathan Wakely
2021-04-21 14:16                   ` Thomas Rodgers
2021-04-21 14:23                   ` David Edelsohn
2021-04-21 14:30                   ` Jonathan Wakely [this message]
2021-04-22 12:27                     ` Jonathan Wakely
2021-04-22 12:30                       ` Jakub Jelinek

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=20210421143019.GY3008@redhat.com \
    --to=jwakely@redhat.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=rodgert@appliantology.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).