[gcc r12-2220] libstdc++: Only use __gthread_yield if gthreads is available

Jonathan Wakely redi@gcc.gnu.org
Fri Jul 9 14:19:45 GMT 2021


https://gcc.gnu.org/g:2e345e4ad6bb6595a9e3b182aa349d4f306b0921

commit r12-2220-g2e345e4ad6bb6595a9e3b182aa349d4f306b0921
Author: Matheus Castanho <msc@linux.ibm.com>
Date:   Fri Jul 9 15:13:38 2021 +0100

    libstdc++: Only use __gthread_yield if gthreads is available
    
    libstdc++-v3/ChangeLog:
    
            * include/std/mutex (__lock_impl): Check
            _GLIBCXX_HAS_GTHREADS before using __gthread_yield.

Diff:
---
 libstdc++-v3/include/std/mutex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index eeb51fdb840..7ab4ee12690 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -618,7 +618,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		      return;
 		    }
 		}
-#ifdef _GLIBCXX_USE_SCHED_YIELD
+#if defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD
 		__gthread_yield();
 #endif
 		constexpr auto __n = 1 + sizeof...(_L1);


More information about the Libstdc++-cvs mailing list