public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Doug Gilmore <Doug.Gilmore@imgtec.com>
To: <gcc-patches@gcc.gnu.org>
Subject: Re: [patch libstdc++] Optimize synchronization in std::future if futexes are available.
Date: Thu, 29 Jan 2015 03:35:00 -0000	[thread overview]
Message-ID: <54C97150.80306@imgtec.com> (raw)
In-Reply-To: <20150118131915.GY3360@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1531 bytes --]

On 01/18/2015 05:19 AM, Jonathan Wakely wrote:
> On 17/01/15 19:51 -0700, Sandra Loosemore wrote:
>> On 01/17/2015 03:58 PM, Jonathan Wakely wrote:
>>>
>>> My fault, this additional chunk is needed alongside the patch I sent
>>> earlier:
>>>
>>> --- a/libstdc++-v3/include/bits/atomic_futex.h
>>> +++ b/libstdc++-v3/include/bits/atomic_futex.h
>>> @@ -35,7 +35,7 @@
>>> #include <bits/c++config.h>
>>> #include <atomic>
>>> #include <chrono>
>>> -#if !defined(_GLIBCXX_HAVE_LINUX_FUTEX)
>>> +#if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1)
>>> #include <mutex>
>>> #include <condition_variable>
>>> #endif
>>>
>>> What I sent earlier causes your target to use std::mutex and
>>> std::condition_variable, but without the bit above the headers aren't
>>> included.
>>
>> Still no joy:
>> /scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/futex.cc:45:3: error: '__atomic_futex_unsigned_base' has not been declared
>>   __atomic_futex_unsigned_base::_M_futex_wait_until(unsigned *__addr,
>>   ^
>> /scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/futex.cc:88:3: error: '__atomic_futex_unsigned_base' has not been declared
>>   __atomic_futex_unsigned_base::_M_futex_notify_all(unsigned* __addr)
>>   ^
> 
> futex.cc needs the same change ...
I am still noticing a problem building a native X86_64 ToT compiler on
Ubuntu 12.04.5 LTS.

Attached is a patch where the CPP guards in atomic_futex.h are
reflected in futex.cc, which fixes my build problem.

OK to commit?

Thanks,

Doug


[-- Attachment #2: 0001-CPP-guards-in-futex.cc-should-match-guards-in-futex..patch --]
[-- Type: text/x-patch, Size: 993 bytes --]

From 1debe13da342ac30d905e12a9ca243e30cb61870 Mon Sep 17 00:00:00 2001
From: Doug Gilmore <doug.gilmore@imgtec.com>
Date: Wed, 28 Jan 2015 14:29:14 -0800
Subject: [PATCH] CPP guards in futex.cc should match guards in futex.ii.

---
 libstdc++-v3/src/c++11/futex.cc |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index 1336779..5087483 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -23,6 +23,7 @@
 // <http://www.gnu.org/licenses/>.
 
 #include <bits/atomic_futex.h>
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 #if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
 #include <chrono>
 #include <climits>
@@ -93,4 +94,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   }
 
 }
-#endif
+#endif // _GLIBCXX_HAVE_LINUX_FUTEX && ATOMIC_INT_LOCK_FREE > 1
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
-- 
1.7.9.5


  parent reply	other threads:[~2015-01-28 23:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-17  6:45 David Edelsohn
2015-01-17  7:24 ` pinskia
2015-01-17  8:06   ` Hans-Peter Nilsson
2015-01-17 11:00     ` Jonathan Wakely
2015-01-17 14:30     ` Jonathan Wakely
2015-01-17 20:55       ` Sandra Loosemore
2015-01-17 21:13         ` Jonathan Wakely
2015-01-17 22:54           ` Sandra Loosemore
2015-01-17 22:58             ` Jonathan Wakely
2015-01-18  0:08               ` Sandra Loosemore
2015-01-18  0:24                 ` Jonathan Wakely
2015-01-18  8:37                   ` Sandra Loosemore
2015-01-18 15:32                     ` Jonathan Wakely
2015-01-18 15:49                       ` Jonathan Wakely
2015-02-01 15:13                         ` Jonathan Wakely
2015-01-29  3:35                       ` Doug Gilmore [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-01-16 17:10 Torvald Riegel
2015-01-16 18:14 ` Jonathan Wakely
2015-01-18 15:50 ` Jonathan Wakely

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=54C97150.80306@imgtec.com \
    --to=doug.gilmore@imgtec.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).