diff mbox

[libstdc++] Optimize synchronization in std::future if futexes are available.

Message ID 20150117134853.GR3360@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Jan. 17, 2015, 1:48 p.m. UTC
On 17/01/15 01:45 -0500, Hans-Peter Nilsson wrote:
>On Fri, 16 Jan 2015, pinskia@gmail.com wrote:
>> > On Jan 16, 2015, at 9:57 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
>> >
>> > This patch has broken bootstrap on AIX
>> >
>> > May I mention that this really should have been tested on systems
>> > other than x86 Linux.
>>
>> It also broke all newlib targets too. So you could have tested one listed in the sim-test web page.
>
>For those interested, PR64638.

Should be fixed in trunk now, by this patch.

Comments

Sandra Loosemore Jan. 17, 2015, 7:59 p.m. UTC | #1
Re:

> On 17/01/15 01:45 -0500, Hans-Peter Nilsson wrote:
>> On Fri, 16 Jan 2015, pinskia@gmail.com wrote:
>>> > On Jan 16, 2015, at 9:57 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
>>> >
>>> > This patch has broken bootstrap on AIX
>>> >
>>> > May I mention that this really should have been tested on systems
>>> > other than x86 Linux.
>>>
>>> It also broke all newlib targets too. So you could have tested one listed in the sim-test web page.
>>
>> For those interested, PR64638.
>
> Should be fixed in trunk now, by this patch.

I'm now getting this error in an arm-none-linux-gnueabi cross build:


In file included from 
/scratch/sandra/arm-fsf2/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux-gnueabi/libstdc++-v3/include/future:44:0,
                  from 
/scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/functexcept.cc:34:
/scratch/sandra/arm-fsf2/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_futex.h:71:3: 
error: #error We require lock-free atomic operations on int
  # error We require lock-free atomic operations on int
    ^

It used to work a few days ago....  nothing changed in my build 
environment except that I did "svn up" in my gcc source directory....

-Sandra
diff mbox

Patch

commit a0fe2162e3b10f6d35e4ea73bae209081bf2e9c2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Jan 17 13:29:17 2015 +0000

    	PR libstdc++/64638
    	* include/bits/atomic_futex.h: Use appropriate config macros for
    	availability of std::mutex, std::condition and std::chrono.

diff --git a/libstdc++-v3/include/bits/atomic_futex.h b/libstdc++-v3/include/bits/atomic_futex.h
index 9a418d8..2673604 100644
--- a/libstdc++-v3/include/bits/atomic_futex.h
+++ b/libstdc++-v3/include/bits/atomic_futex.h
@@ -48,6 +48,7 @@  namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 #if defined(_GLIBCXX_HAVE_LINUX_FUTEX)
   struct __atomic_futex_unsigned_base
   {
@@ -209,7 +210,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   };
 
-#else
+#else // !_GLIBCXX_HAVE_LINUX_FUTEX
 
   // If futexes are not available, use a mutex and a condvar to wait.
   // Because we access the data only within critical sections, all accesses
@@ -280,7 +281,8 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   };
 
-#endif
+#endif // _GLIBCXX_HAVE_LINUX_FUTEX
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std