Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-10-02 Thread Jonathan Wakely via Gcc-patches
On 26/09/20 20:42 +0100, Jonathan Wakely wrote: Glibc 2.32 adds a global variable that says whether the process is single-threaded. We can use this to decide whether to elide atomic operations, as a more precise and reliable indicator than __gthread_active_p. This means that guard variables for

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-10-01 Thread Jonathan Wakely via Gcc-patches
On 01/10/20 08:50 +0100, Jonathan Wakely wrote: On 01/10/20 09:30 +0200, Christophe Lyon via Libstdc++ wrote: On Wed, 30 Sep 2020 at 22:44, Jonathan Wakely wrote: On 30/09/20 16:03 +0100, Jonathan Wakely wrote: On 29/09/20 13:51 +0200, Christophe Lyon via Libstdc++ wrote: On Sat, 26 Sep 202

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-10-01 Thread Jonathan Wakely via Gcc-patches
On 01/10/20 09:30 +0200, Christophe Lyon via Libstdc++ wrote: On Wed, 30 Sep 2020 at 22:44, Jonathan Wakely wrote: On 30/09/20 16:03 +0100, Jonathan Wakely wrote: >On 29/09/20 13:51 +0200, Christophe Lyon via Libstdc++ wrote: >>On Sat, 26 Sep 2020 at 21:42, Jonathan Wakely via Gcc-patches >> w

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-10-01 Thread Christophe Lyon via Gcc-patches
On Wed, 30 Sep 2020 at 22:44, Jonathan Wakely wrote: > > On 30/09/20 16:03 +0100, Jonathan Wakely wrote: > >On 29/09/20 13:51 +0200, Christophe Lyon via Libstdc++ wrote: > >>On Sat, 26 Sep 2020 at 21:42, Jonathan Wakely via Gcc-patches > >> wrote: > >>> > >>>Glibc 2.32 adds a global variable that

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-09-30 Thread Jonathan Wakely via Gcc-patches
On 30/09/20 16:03 +0100, Jonathan Wakely wrote: On 29/09/20 13:51 +0200, Christophe Lyon via Libstdc++ wrote: On Sat, 26 Sep 2020 at 21:42, Jonathan Wakely via Gcc-patches wrote: Glibc 2.32 adds a global variable that says whether the process is single-threaded. We can use this to decide whet

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-09-30 Thread Jonathan Wakely via Gcc-patches
On 29/09/20 13:51 +0200, Christophe Lyon via Libstdc++ wrote: On Sat, 26 Sep 2020 at 21:42, Jonathan Wakely via Gcc-patches wrote: Glibc 2.32 adds a global variable that says whether the process is single-threaded. We can use this to decide whether to elide atomic operations, as a more precise

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-09-29 Thread Christophe Lyon via Gcc-patches
On Sat, 26 Sep 2020 at 21:42, Jonathan Wakely via Gcc-patches wrote: > > Glibc 2.32 adds a global variable that says whether the process is > single-threaded. We can use this to decide whether to elide atomic > operations, as a more precise and reliable indicator than > __gthread_active_p. > > Thi

Re: [committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-09-27 Thread Florian Weimer
* Jonathan Wakely via Libstdc: > We can't use __libc_single_threaded to replace __gthread_active_p > everywhere. If we replaced the uses of __gthread_active_p in std::mutex > then we would elide the pthread_mutex_lock in the code below, but not > the pthread_mutex_unlock: > > std::mutex m; > m

[committed] libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]

2020-09-26 Thread Jonathan Wakely via Gcc-patches
Glibc 2.32 adds a global variable that says whether the process is single-threaded. We can use this to decide whether to elide atomic operations, as a more precise and reliable indicator than __gthread_active_p. This means that guard variables for statics and reference counting in shared_ptr can u