public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9613] libstdc++: Fix <stop_token> to compile without gthreads
@ 2021-03-29 20:05 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-03-29 20:05 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:05defd6e5bd62285f13a096f447df4ee2e9981ef
commit r10-9613-g05defd6e5bd62285f13a096f447df4ee2e9981ef
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Aug 11 16:16:21 2020 +0100
libstdc++: Fix <stop_token> to compile without gthreads
libstdc++-v3/ChangeLog:
* include/std/stop_token: Check _GLIBCXX_HAS_GTHREADS using
#ifdef instead of #if.
(stop_token::_S_yield()): Check _GLIBCXX_HAS_GTHREADS before
using __gthread_yield.
(cherry picked from commit 35e5294c4b779f8fc24fdc86464f999867332995)
Diff:
---
libstdc++-v3/include/std/stop_token | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/include/std/stop_token b/libstdc++-v3/include/std/stop_token
index 34b613e7c1a..90b967ec605 100644
--- a/libstdc++-v3/include/std/stop_token
+++ b/libstdc++-v3/include/std/stop_token
@@ -105,7 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
#if defined __i386__ || defined __x86_64__
__builtin_ia32_pause();
-#elif defined _GLIBCXX_USE_SCHED_YIELD
+#elif defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD
__gthread_yield();
#endif
}
@@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::atomic<value_type> _M_owners{1};
std::atomic<value_type> _M_value{_S_ssrc_counter_inc};
_Stop_cb* _M_head = nullptr;
-#if _GLIBCXX_HAS_GTHREADS
+#ifdef _GLIBCXX_HAS_GTHREADS
__gthread_t _M_requester;
#endif
@@ -237,7 +237,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
while (!_M_try_lock_and_stop(__old));
-#if _GLIBCXX_HAS_GTHREADS
+#ifdef _GLIBCXX_HAS_GTHREADS
#ifdef _GLIBCXX_NATIVE_THREAD_ID
_M_requester = _GLIBCXX_NATIVE_THREAD_ID;
#else
@@ -270,7 +270,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (!__destroyed)
{
__cb->_M_destroyed = nullptr;
-#if _GLIBCXX_HAS_GTHREADS
+#ifdef _GLIBCXX_HAS_GTHREADS
// synchronize with destructor of stop_callback that owns *__cb
__cb->_M_done.release();
#endif
@@ -347,7 +347,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Callback is not in the list, so must have been removed by a call to
// _M_request_stop.
-#if _GLIBCXX_HAS_GTHREADS
+#ifdef _GLIBCXX_HAS_GTHREADS
#ifdef _GLIBCXX_NATIVE_THREAD_ID
auto __tid = _GLIBCXX_NATIVE_THREAD_ID;
#else
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-29 20:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 20:05 [gcc r10-9613] libstdc++: Fix <stop_token> to compile without gthreads Jonathan Wakely
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).