[PATCH] [libstdc++] Refactor/cleanup of atomic wait implementation

2021-02-22 Thread Thomas Rodgers
From: Thomas Rodgers This is a substantial rewrite of the atomic wait/notify (and timed wait counterparts) implementation. The previous __platform_wait looped on EINTR however this behavior is not required by the standard. A new _GLIBCXX_HAVE_PLATFORM_WAIT macro now controls whether wait/notify

[PATCH] [libstdc++] Refactor/cleanup of atomic wait implementation

2021-02-23 Thread Thomas Rodgers
From: Thomas Rodgers * This revises the previous version to fix std::__condvar::wait_until() usage. This is a substantial rewrite of the atomic wait/notify (and timed wait counterparts) implementation. The previous __platform_wait looped on EINTR however this behavior is not required by the

Re: [PATCH 4/5] barrier: use int instead of unsigned char for the phase state

2021-03-01 Thread Thomas Rodgers
On 2021-02-28 07:05, Hans-Peter Nilsson wrote: On Fri, 26 Feb 2021, Thiago Macieira via Gcc-patches wrote: ints can be used in futexes. chars can't. Shouldn't that be an atomic type instead of a bare int then? It's an atomic_ref. --- libstdc++-v3/include/std/barrier | 21 ---

Re: [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int

2021-03-01 Thread Thomas Rodgers
On 2021-02-28 13:31, Hans-Peter Nilsson wrote: On Fri, 26 Feb 2021, Thiago Macieira via Gcc-patches wrote: On Friday, 26 February 2021 11:31:00 PST Andreas Schwab wrote: On Feb 26 2021, Thiago Macieira wrote: On Friday, 26 February 2021 10:14:42 PST Andreas Schwab wrote: On Feb 26 2021, Thiag

Re: [PATCH 4/5] barrier: use int instead of unsigned char for the phase state

2021-03-01 Thread Thomas Rodgers
On 2021-03-01 09:24, Thiago Macieira via Libstdc++ wrote: On Sunday, 28 February 2021 07:05:47 PST Hans-Peter Nilsson wrote: On Fri, 26 Feb 2021, Thiago Macieira via Gcc-patches wrote: ints can be used in futexes. chars can't. Shouldn't that be an atomic type instead of a bare int then? The

Re: [PATCH 4/5] barrier: use int instead of unsigned char for the phase state

2021-03-01 Thread Thomas Rodgers
Botched replying to the list, sending again On 2021-03-01 09:38, Thomas Rodgers wrote: On 2021-03-01 09:24, Thiago Macieira via Libstdc++ wrote: On Sunday, 28 February 2021 07:05:47 PST Hans-Peter Nilsson wrote: On Fri, 26 Feb 2021, Thiago Macieira via Gcc-patches wrote: ints can be used in

Re: [PATCH 4/5] barrier: use int instead of unsigned char for the phase state

2021-03-01 Thread Thomas Rodgers
On 2021-03-01 10:06, Thiago Macieira wrote: On Monday, 1 March 2021 09:38:58 PST Thomas Rodgers wrote: And _M_phase, despite being non-atomic, is never accessed without the atomic_ref, aside from the constructor. Both arrive() and wait() start off by creating the atomic_ref. If it's non-a

[PATCH] libstdc++: Add C++2a synchronization support

2020-09-11 Thread Thomas Rodgers
From: Thomas Rodgers This patch supercedes both the Add C++2a synchronization support patch being replied to *and* the patch adding wait/notify_* to atomic_flag. Add support for - * atomic_flag::wait/notify_one/notify_all * atomic::wait/notify_one/notify_all * counting_semaphore

[PATCH] libstdc++: only pull in bits/align.h if C++11 or later

2020-09-12 Thread Thomas Rodgers
From: Thomas Rodgers libstdc++-v3/ChangeLog: * include/std/memory: Move #include inside C++11 conditional includes. Tested x86_64-pc-linux-gnu, committed to master. --- libstdc++-v3/include/std/memory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

Re: [PATCH] Fix overflow handling in std::align

2020-09-14 Thread Thomas Rodgers
> On Sep 14, 2020, at 7:30 AM, Ville Voutilainen via Libstdc++ > wrote: > > On Mon, 14 Sep 2020 at 15:49, Glen Fernandes wrote: >> >> On Mon, Sep 14, 2020 at 5:52 AM Ville Voutilainen wrote: >>> On Mon, 14 Sep 2020 at 12:51, Ville Voutilainen >>> wrote: On Mon, 14 Sep 2020 at 09:18, Gl

Re: [PATCH] libstdc++: Rebase include/pstl to current upstream

2020-09-21 Thread Thomas Rodgers
> On Sep 21, 2020, at 7:40 AM, Jonathan Wakely wrote: > > On 15/09/20 20:35 -0700, Thomas Rodgers wrote: >> From: Thomas Rodgers >> >> From llvm-project/pstl @ 0b2e0e80d96 >> >> libstdc++-v3/ChangeLog: >> >> * include/pstl/al

[PATCH] libstdc++: Add C++2a synchronization support

2020-10-01 Thread Thomas Rodgers
From: Thomas Rodgers Updated patch incorporating latest feedback. Add support for - * atomic_flag::wait/notify_one/notify_all * atomic::wait/notify_one/notify_all * counting_semaphore * binary_semaphore * latch libstdc++-v3/ChangeLog: * include/Makefile.am (bits_headers

[PATCH] libstdc++: Add C++2a synchronization support

2020-10-02 Thread Thomas Rodgers
From: Thomas Rodgers Updated patch incorporating latest feedback (revised). Add support for - * atomic_flag::wait/notify_one/notify_all * atomic::wait/notify_one/notify_all * counting_semaphore * binary_semaphore * latch libstdc++-v3/ChangeLog: * include/Makefile.am

[PATCH] t/trodgers/c2a_synchronization

2020-10-05 Thread Thomas Rodgers
From: Thomas Rodgers This *should* be the correct patch this time. Add support for - * atomic_flag::wait/notify_one/notify_all * atomic::wait/notify_one/notify_all * counting_semaphore * binary_semaphore * latch libstdc++-v3/ChangeLog: * include/Makefile.am (bits_headers

[PATCH] libstdc++: Implement C++20 features for

2020-10-07 Thread Thomas Rodgers
From: Thomas Rodgers New ctors and ::view() accessor for - * basic_stingbuf * basic_istringstream * basic_ostringstream * basic_stringstreamm New ::get_allocator() accessor for basic_stringbuf. libstdc++-v3/ChangeLog: * acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20

[PATCH] libstdc++: Implement C++20 features for

2020-10-07 Thread Thomas Rodgers
From: Thomas Rodgers New ctors and ::view() accessor for - * basic_stingbuf * basic_istringstream * basic_ostringstream * basic_stringstreamm New ::get_allocator() accessor for basic_stringbuf. libstdc++-v3/ChangeLog: * acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20

[PATCH] libstdc++: Implement C++20 features for

2020-10-07 Thread Thomas Rodgers
From: Thomas Rodgers New ctors and ::view() accessor for - * basic_stingbuf * basic_istringstream * basic_ostringstream * basic_stringstreamm New ::get_allocator() accessor for basic_stringbuf. libstdc++-v3/ChangeLog: * acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20

[PATCH] Add support for C++2a stop_token

2019-10-22 Thread Thomas Rodgers
0001-Add-support-for-C-2a-stop_token.patch Description: le patch

[PATCH] Add C++20 jthread type to --text follows this line-<#part type="text/x-patch" filename="/home/remote/trodgers/src/oss/gcc/jt/0001-Add-C-20-jthread-type-to-thread.patch" disposition=at

2019-10-23 Thread Thomas Rodgers

[PATCH] Add C++20 jthread type to (2nd attempt)

2019-10-23 Thread Thomas Rodgers
From 56b78956a003b91e538cd5c680d614fdaee9c9eb Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Wed, 23 Oct 2019 12:32:31 -0700 Subject: [PATCH] Add C++20 jthread type to --- libstdc++-v3/ChangeLog| 8 + libstdc++-v3/include/std/stop_token | 14

Re: [PATCH] Add support for C++2a stop_token

2019-10-23 Thread Thomas Rodgers
Thomas Rodgers writes: Let's try this again.From 23e1c9402cc15666d099fd61b58a0019181a9115 Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Tue, 22 Oct 2019 17:53:00 -0700 Subject: [PATCH] Add support for C++2a stop_token * include/Makefile.am: Add header. * include/Makefi

Re: [PATCH] Add support for C++2a stop_token

2019-11-13 Thread Thomas Rodgers
The attached patch should be a complete implementation of C++20 stop_token, jthread, and changes to condition_variable_any which also addresses the comments on the previous patch. From 2cdaa367ed919b24f3bbb84d6f7391a350dce77b Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Wed, 13 Nov 2019

[PATCH] libstdc++: Add c++2a

2020-11-02 Thread Thomas Rodgers
From: Thomas Rodgers Changes implementation to use a private __mutex type as discussed on IRC. libstdc++/ChangeLog: libstdc++-v3/doc/doxygen/user.cfg.in (INPUT): Add new header. libstdc++-v3/include/Makefile.am (std_headers): Add new header. libstdc++-v3/include

[PATCH] libstdc++: Add c++2a

2020-11-02 Thread Thomas Rodgers
From: Thomas Rodgers IGNORE the previous patch. Changes implementation to use a private __mutex type as discussed on IRC. libstdc++/ChangeLog: libstdc++-v3/doc/doxygen/user.cfg.in (INPUT): Add new header. libstdc++-v3/include/Makefile.am (std_headers): Add new header

[PATCH] libstdc++: Add support for C++20 barriers

2020-11-04 Thread Thomas Rodgers
From: Thomas Rodgers Adds libstdc++/ChangeLog: * include/Makefile.am (std_headers): Add new header. * include/Makefile.in: Regenerate. * include/std/barrier: New file. * testsuite/30_thread/barrier/1.cc: New test. * testsuite/30_thread/barrier/2.cc

[PATCH] libstdc++: Add support for C++20 barriers

2020-11-04 Thread Thomas Rodgers
From: Thomas Rodgers IGNORE the previous version of this patch please. Adds libstdc++/ChangeLog: * include/Makefile.am (std_headers): Add new header. * include/Makefile.in: Regenerate. * include/std/barrier: New file. * testsuite/30_thread/barrier/1.cc: New

Re: [PATCH] libstdc++: Add support for C++20 barriers

2020-11-04 Thread Thomas Rodgers
> On Nov 4, 2020, at 10:52 AM, Jonathan Wakely wrote: > > On 04/11/20 10:41 -0800, Thomas Rodgers wrote: >> From: Thomas Rodgers >> >> IGNORE the previous version of this patch please. > > OK, but all my comments seem to apply to this one too. >

Re: [PATCH] libstdc++: Add support for C++20 barriers

2020-11-04 Thread Thomas Rodgers
> On Nov 4, 2020, at 10:50 AM, Jonathan Wakely wrote: > > On 04/11/20 09:29 -0800, Thomas Rodgers wrote: >> From: Thomas Rodgers >> >> Adds >> >> libstdc++/ChangeLog: >> >> * include/Makefile.am (std_headers): Add ne

Re: [PATCH] libstdc++: Implement C++20 features for

2020-11-04 Thread Thomas Rodgers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97719 > On Nov 4, 2020, at 11:54 AM, Stephan Bergmann wrote: > > On 07/10/2020 18:55, Thomas Rodgers wrote: >> From: Thomas Rodgers >> New ctors and ::view() accessor for - >> * basic_stingbuf >> * basic_istring

Re: [PATCH] libstdc++: Enable without gthreads

2020-11-16 Thread Thomas Rodgers
This patch looks good to me. It would be great to find a way to do a similar refactoring of condition_variable. > On Nov 12, 2020, at 9:07 AM, Jonathan Wakely via Libstdc++ > wrote: > > On 11/11/20 17:31 +, Jonathan Wakely wrote: >> On 11/11/20 16:13 +, Jonathan Wakely wrote: >>> This

[PATCH] Suppress deprecation warnings in tbb effective target check

2020-01-23 Thread Thomas Rodgers
From cfd3c2e2a49dd3e29b42baa0f22feffd4b346231 Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Thu, 23 Jan 2020 21:54:44 -0800 Subject: [PATCH] Suppress deprecation warnings in tbb effective target check TBB 2020 added deprecation warnings which produced output not expected by

Re: [PATCH] libstdc++: Fix conformance issues in (PR92895)

2020-01-29 Thread Thomas Rodgers
Looks good to me, ok for trunk. Thanks. Jonathan Wakely writes: > Fix synchronization issues in . Replace shared_ptr with > _Stop_state_ref and a reference count embedded in the shared state. > Replace std::mutex with spinlock using one bit of a std::atomic<> that > also tracks whether a stop re

[PATCH] libstdc++: Fix UB in atomic_ref/wait_notify.cc [PR101761]

2021-09-16 Thread Thomas Rodgers
From: Thomas Rodgers Remove UB in atomic_ref/wait_notify test. Signed-off-by: Thomas Rodgers libstdc++-v3/ChangeLog: PR libstdc++/101761 * testsuite/29_atomics/atomic_ref/wait_notify.cc (test): Use va and vb as arguments to wait/notify, remove unused bb local. Tested

[PATCH] libstdc++: Implement C++20 atomic and atomic

2021-09-17 Thread Thomas Rodgers
From: Thomas Rodgers Signed-off-by: Thomas Rodgers libstdc++-v3/ChangeLog: * config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Do not match new _Sp_locker constructor. (GLIBCXX_3.4.30): Export _Sp_locker::_M_wait/_M_notify and new constructor. * include/bits

[PATCH] libstdc++: Implement C++20 atomic and atomic

2021-09-17 Thread Thomas Rodgers
From: Thomas Rodgers Let's try this one instead. Signed-off-by: Thomas Rodgers libstdc++-v3/ChangeLog: * acinclude.m4: Update ABI version. * config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Do not match new _Sp_locker constructor. (GLIBCXX_3.4.30): Export _Sp_l

[PATCH] libstdc++: Clear padding bits in atomic compare_exchange

2021-09-23 Thread Thomas Rodgers
From: Thomas Rodgers This change implements P0528 which requires that padding bits not participate in atomic compare exchange operations. All arguments to the generic template are 'sanitized' by the __builtin_clear_padding intrinsic before they are used in atomic compare_exch

[PATCH] libstdc++: Clear padding bits in atomic compare_exchange

2021-09-27 Thread Thomas Rodgers
From: Thomas Rodgers Now with checks for __has_builtin(__builtin_clear_padding) This change implements P0528 which requires that padding bits not participate in atomic compare exchange operations. All arguments to the generic template are 'sanitized' by the __builtin_clearpaddin

Re: [PATCH] Restore enable_if lost during original import of pstl

2019-12-10 Thread Thomas Rodgers
Tested x86_64-pc-linux-gnu, committed to trunk, backported to gcc-9-branch. Jonathan Wakely writes: > On 18/11/19 20:54 -0800, Thomas Rodgers wrote: >> >> * include/pstl/glue_numeric_defs.h: Restore enable_if lost during >> original >> import of p

[PATCH] Rename condition_variable_any::wait_on_* methods

2019-12-10 Thread Thomas Rodgers
User-agent: mu4e 1.3.4; emacs 26.2 * include/std/condition_variable (condition_variable_any::wait_on(_Lock&, stop_token, _Predicate): Rename to match current draft standard. (condition_variable_any::wait_on_until(_Lock&, stop_token, const chrono::time_point<>

Re: [PATCH] Rename condition_variable_any::wait_on_* methods

2020-01-07 Thread Thomas Rodgers
Tested x86_64-pc-linux-gnu, committed to trunk. Jonathan Wakely writes: > On 10/12/19 22:38 -0800, Thomas Rodgers wrote: >>User-agent: mu4e 1.3.4; emacs 26.2 >> * include/std/condition_variable >> (condition_variable_any::wait_on(_Lock&, stop_token, _Pred

Re: [PATCH] libstdc++: Clear padding bits in atomic compare_exchange

2021-11-02 Thread Thomas Rodgers
Jelinek wrote: > On Mon, Nov 01, 2021 at 06:25:45PM -0700, Thomas Rodgers via Gcc-patches > wrote: > > +template > > + constexpr bool > > + __maybe_has_padding() > > + { > > +#if __has_builtin(__has_unique_object_representations) > > + r

[PATCH] [libstdc++] Remove unused hasher instance.

2021-06-04 Thread Thomas Rodgers
This is a remnant of poorly executed refactoring. libstdc++-v3/ChangeLog: * include/std/barrier (__tree_barrier::_M_arrive): Remove unnecessary hasher instantiation. --- libstdc++-v3/include/std/barrier | 1 - 1 file changed, 1 deletion(-) diff --git a/libstdc++-v3/include/std/b

[PATCH] [libstdc++] Cleanup atomic timed wait implementation

2021-06-04 Thread Thomas Rodgers
This cleans up the implementation of atomic_timed_wait.h and fixes the accidental pessimization of spinning after waiting in __timed_waiter_pool::_M_do_wait_until. libstdc++-v3/ChangeLog: * include/bits/atomic_timed_wait.h (__wait_clock_t): Define conditionally. (__cond_wa

[PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait

2021-06-04 Thread Thomas Rodgers
Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889 libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait): Change parameter type from _Tp to _Tp*. * testsuite/29_atomics/atomic_ref/deduction.cc: Add reproducer case from PR. --- libstd

[PATCH] [libstdc++] Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]

2021-06-04 Thread Thomas Rodgers
Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889 libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait): Change parameter type from _Tp to _Tp*. * testsuite/29_atomics/atomic_ref/100889.cc: New test. --- libstdc++-v3/include/bits/atomic_bas

[PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] [PR100889]

2021-06-07 Thread Thomas Rodgers
Fixes libstdc++/100889 libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait): Change parameter type from _Tp to _Tp*. * testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend coverage of types tested. --- libstdc++-v3/include/bits/atomic_ba

[PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]

2021-06-07 Thread Thomas Rodgers
This time without the repeatred [PR] in the subject line. Fixes libstdc++/100889 libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait): Change parameter type from _Tp to _Tp*. * testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend cov

Re: [PATCH] Document that -fno-trampolines is for Ada only [PR100735]

2021-06-09 Thread Thomas Rodgers
On 2021-06-09 09:23, Jeff Law via Gcc-patches wrote: On 5/25/2021 2:23 PM, Paul Eggert wrote: The GCC manual's documentation of -fno-trampolines was apparently written from an Ada point of view. However, when I read it I understandably mistook it to say that -fno-trampolines also works for C,

[committed] libstdc++: Only support atomic_ref::wait tests which are always lockfree

2021-06-09 Thread Thomas Rodgers
Fixes a regression on arm32 targets. libstdc++/ChangeLog: * testsuite/29_atomics/atomic_ref/wait_notify.cc: Guard test logic with constexpr check for is_always_lock_free. As discussed on IRC. Tested x86_64-pc-linux-gnu, committed to master, backported to releases/gcc-11. --- ...

Re: [PATCH] c++: implement C++17 hardware interference size

2021-07-20 Thread Thomas Rodgers
On 2021-07-17 06:32, Jonathan Wakely via Gcc-patches wrote: On Sat, 17 Jul 2021, 09:15 Matthias Kretz, wrote: On Friday, 16 July 2021 21:58:36 CEST Jonathan Wakely wrote: On Fri, 16 Jul 2021 at 20:26, Matthias Kretz wrote: On Friday, 16 July 2021 18:54:30 CEST Jonathan Wakely wrote: On Fri,

[PATCH] libstdc++: Fix wrong thread waking on notify [PR100334]

2021-05-03 Thread Thomas Rodgers
From: Thomas Rodgers This should also be backported to gcc-11 libstdc++/ChangeLog: * include/bits/atomic_wait.h (__waiter::_M_do_wait_v): loop until observe value change. (__waiter_base::_M_laundered): New member. (__watier_base::_M_notify): Check _M_laundered to

[PATCH] libstdc++: Fix wrong thread waking on notify [PR100334]

2021-05-13 Thread Thomas Rodgers
From: Thomas Rodgers libstdc++/ChangeLog: * include/bits/atomic_wait.h (__waiter::_M_do_wait_v): loop until value change observed. (__waiter_base::_M_a): Renamed member from _M_addr, changed type to uintptr_t. (__waiter_base::_S_wait_addr): Change return

[PATCH] libstdc++: Fix wrong thread waking on notify [PR100334]

2021-05-13 Thread Thomas Rodgers
From: Thomas Rodgers Please ignore the previous patch. This one removes the need to carry any extra state in the case of a 'laundered' atomic wait. libstdc++/ChangeLog: * include/bits/atomic_wait.h (__waiter::_M_do_wait_v): loop until value chang

Re: [PATCH] libstdc++: Fix wrong thread waking on notify [PR100334]

2021-05-17 Thread Thomas Rodgers
On 2021-05-17 09:43, Jonathan Wakely wrote: On 14/05/21 18:09 +0100, Jonathan Wakely wrote: On 13/05/21 18:54 -0700, Thomas Rodgers wrote: From: Thomas Rodgers Please ignore the previous patch. This one removes the need to carry any extra state in the case of a 'laundered' a

Re: [PATCH 1/2] libstdc++: Atomic wait/notify ABI stabilization

2023-12-14 Thread Thomas Rodgers
I need to look at this a bit more (and not on my phone, at lunch). Ultimately, C++26 expects to add predicate waits and returning a ‘tri-state’ result isn’t something that’s been considered or likely to be approved. On Mon, Dec 11, 2023 at 12:18 PM Jonathan Wakely wrote: > CCing Tom's current ad

[PATCH] Add C++2a synchronization support

2020-09-02 Thread Thomas Rodgers
Adds support for - atomic wait/notify_one/notify_all counting_semaphore binary_semaphore latch * include/Makefile.am (bits_headers): Add new header. * include/Makefile.in: Regenerate. * include/bits/atomic_base.h (__atomic_base<_Itp>::wait):

[PATCH] Add C++2a synchronization support

2020-09-02 Thread Thomas Rodgers
Note - ignore previous version of this patch, didn't filter out Makefile.in Adds support for - atomic wait/notify_one/notify_all counting_semaphore binary_semaphore latch * include/Makefile.am (bits_headers): Add new header. * include/Makefile.in: R

[PATCH] Add support for C++20 barriers

2020-09-07 Thread Thomas Rodgers
Re-sending Adds * include/Makefile.am (std_headers): Add new header. * include/Makefile.in: Regenerate. * include/bits/atomic_base.h (__atomic_base<_Itp>::_M_wait): Define. (__atomic_base<_Itp>::wait): Delegate to _M_wait. * include/std/barrier: New file.

[PATCH] Add support for atomic_flag::wait/notify_one/notify_all

2020-09-08 Thread Thomas Rodgers
* include/bits/atomic_base.h (__atomic_flag::wait): Define. (__atomic_flag::notify_one): Likewise. (__atomic_flag::notify_all): Likewise. * testsuite/29_atomics/atomic_flag/wait_notify/1.cc: New test. --- libstdc++-v3/include/bits/atomic_base.h | 23 +++ .

[PATCH] Split std::align/assume_aligned to bits/align.h

2020-09-09 Thread Thomas Rodgers
We would like to be able to use these things without having to pull in the whole of . * include/Makefile.am (bits_headers): Add new header. * include/Makefile.in: Regenerate. * include/bits/align.h: New file. * include/std/memory (align): Move definition to bits/ali

[PATCH] Add c++2a binary_semaphore

2020-02-17 Thread Thomas Rodgers
/semaphore/try_acquire.cc: New test. * testsuite/30_threads/semaphore/try_acquire_for.cc: New test. * testsuite/30_threads/semaphore/try_acquire_until.cc: New test. From 8ce4252605361ed33b389a91fb7e3aeec529d9ac Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Mon, 17 Feb 2020 19:58

Re: [PATCH] Add c++2a binary_semaphore

2020-02-24 Thread Thomas Rodgers
Hopefully less borked than the previous one, adds futex support. - Original Message - From: "Thomas Rodgers" To: gcc-patches@gcc.gnu.org, libstd...@gcc.gnu.org Sent: Wednesday, February 19, 2020 7:18:36 PM Subject: Re: [PATCH] Add c++2a binary_semaphore Should address th

[PATCH] Add C++2a wait/notify_one/notify_all support to std::atomic<>

2020-03-15 Thread Thomas Rodgers
This patch adds support for wait/notify_one/notify_all to std::atomic<>. Support for the volatile overloads will be added in a subsequent patch. * include/Makefile.am (bits_headers): Add new header. * include/Mamefile.in: Regenerate. * include/bits/atomic_base.h (__atomic_b

Re: [PATCH] Include netinet/in.h in include/experimental/internet

2019-09-30 Thread Thomas Rodgers
Looks good to me. Andreas Tobler writes: > Hi all, > > I'm going to commit the attached patch to trunk. > It is preapproved by Jonathan. (via #irc) > > On FreeBSD the netinet/in.h header is not included by arpa/inet.h, so do the > include if we have the _GLIBCXX_HAVE_NETINET_IN_H defined. > > Thi

[PATCH] Add support for C++20 barriers

2020-05-23 Thread Thomas Rodgers
This patch requires the patch for atomic::wait/notify to be applied first. This implementation is based on the libc++ implementation, but excludes the alternative “central barrier” implementation for now as there is no standard way to switch between the two. * include/Makefile.am (std_h

Re: [PATCH] Add support for C++20 barriers

2020-05-24 Thread Thomas Rodgers
This time with 100% more patch… 0001-Add-support-for-C-20-barriers_f.patch Description: Binary data > On May 23, 2020, at 3:58 PM, Thomas Rodgers wrote: > > This patch requires the patch for atomic::wait/notify to be applied first. > > This implementation is ba

Re: [PATCH] Add support for C++20 barriers

2020-05-24 Thread Thomas Rodgers
> On May 24, 2020, at 11:11 AM, Jonathan Wakely wrote: > > On Sun, 24 May 2020 at 18:55, Florian Weimer wrote: >> >> * Thomas Rodgers: >> >>> + static __gthread_t >>> + _S_get_tid() noexcept >>> + { >>> +#ifdef

[PATCH] Adjust wait logic to limit spurious evalution of wait predicate.

2020-05-24 Thread Thomas Rodgers
* include/bits/atomic_wait.h (__waiters::_M_do_wait): adjust wakeup logic.

[PATCH] Remove binary_semaphore implementation from stop_token

2020-05-24 Thread Thomas Rodgers
* include/std/stop_token: Remove local binary_semaphore implementation. (_Stop_state_t::_M_do_try_lock): Use __thread_yield() from bits/atomic_wait.h. 0001-Remove-binary_semaphore-implementation-from-stop_tok.patch Description: Binary data

Re: [PATCH] Adjust wait logic to limit spurious evalution of wait predicate.

2020-05-24 Thread Thomas Rodgers
And this time, with patch. wake_up_fix.patch Description: Binary data > On May 24, 2020, at 3:06 PM, Thomas Rodgers wrote: > > * include/bits/atomic_wait.h (__waiters::_M_do_wait): adjust wakeup > logic.

[PATCH] libstdc++: Add support for C++20 barriers

2020-12-17 Thread Thomas Rodgers
From: Thomas Rodgers Let's see if this one sticks... Adds libstdc++/ChangeLog: * doc/doxygen/user.cfg.in: Add new header. * include/Makefile.am (std_headers): likewise. * include/Makefile.in: Regenerate. * include/precompiled/stdc++.h: Add new h

[PATCH] libstdc++: Add support for C++20 barriers

2020-12-17 Thread Thomas Rodgers
From: Thomas Rodgers Cleans up a few things mentioned on IRC. Adds libstdc++/ChangeLog: * doc/doxygen/user.cfg.in: Add new header. * include/Makefile.am (std_headers): likewise. * include/Makefile.in: Regenerate. * include/precompiled/stdc++.h: Add new header

[PATCH] Add C++2a synchronization support

2020-06-05 Thread Thomas Rodgers
Add support for - atomic wait/notify_one/notify_all counting_semaphore binary_semaphore latch * include/Makefile.am (bits_headers): Add new header. * include/Makefile.in: Regenerate. * include/bits/atomic_base.h (__atomic_base<_Itp>::wait): D

[PATCH] Add support for C++20 barriers

2020-06-06 Thread Thomas Rodgers
* include/Makefile.am (std_headers): Add new header. * include/Makefile.in: Regenerate. * include/std/barrier: New file. * testsuite/30_thread/barrier/1.cc: New test. * testsuite/30_thread/barrier/2.cc: Likewise. * testsuite/30_thread/barrier/arrive_a

[PATCH] Add C++2a synchronization support

2020-06-06 Thread Thomas Rodgers
Add support for - atomic wait/notify_one/notify_all counting_semaphore binary_semaphore latch * include/Makefile.am (bits_headers): Add new header. * include/Makefile.in: Regenerate. * include/bits/atomic_base.h (__atomic_base<_Itp>::wait): D

[PATCH 3/4] Adjust wait logic to limit spurious eval of wait predicate.

2020-06-06 Thread Thomas Rodgers
* include/bits/atomic_wait.h (__waiters::_M_do_wait): adjust wakeup logic. --- libstdc++-v3/include/bits/atomic_wait.h | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_

[PATCH] Remove binary_semaphore implementation from stop_token

2020-06-06 Thread Thomas Rodgers
* include/std/stop_token: Remove local binary_semaphore implementation. (_Stop_state_t::_M_do_try_lock): Use __thread_yield() from bits/atomic_wait.h. --- libstdc++-v3/include/std/stop_token | 40 ++--- 1 file changed, 2 insertions(+), 38 deletio

Re: [PATCH] libstdc++: Add C++2a synchronization support

2020-11-20 Thread Thomas Rodgers
Tested x86_64-pc-linux-gnu, committed. > On Oct 27, 2020, at 3:23 AM, Jonathan Wakely wrote: > > On 26/10/20 14:48 -0700, Thomas Rodgers wrote: >> +#include >> + >> +#if __has_include() >> +#define _GLIBCXX_HAVE_POSIX_SEMAPHORE 1 >> +#include > >

[PATCH] libstdc++: Add support for C++20 barriers

2020-11-20 Thread Thomas Rodgers
From: Thomas Rodgers Should include all discussion on and off list to date. Adds libstdc++/ChangeLog: * include/Makefile.am (std_headers): Add new header. * include/Makefile.in: Regenerate. * include/std/barrier: New file. * include/std/version: Add

[PATCH] Add feature test macro for atomic::wait

2020-11-30 Thread Thomas Rodgers
From: Thomas Rodgers Adds __cpp_lib_atomic_wait feature test macro which was overlooked in the initial commit of this feature. Replaces uses of _GLIBCXX_HAVE_ATOMIC_WAIT. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h: Replace usage of _GLIBCXX_HAVE_ATOMIC_WAIT with

[PATCH] libstdc++: Add c++2a

2020-10-15 Thread Thomas Rodgers
From: Thomas Rodgers * Note: depends on a sufficiently C++20ified basic_stringbuf<>. libstdc++/Changelog: libstdc++-v3/include/Makefile.am (std_headers): Add new header. libstdc++-v3/include/Makefile.in: Regenerate. libstdc++-v3/include/std/streambuf (__

[PATCH] libstdc++: Add c++2a

2020-10-15 Thread Thomas Rodgers
From: Thomas Rodgers This should address the cumulative comments (modulo the discussion going on on the reflector about specification issues/questions). libstdc++/Changelog: libstdc++-v3/doc/doxygen/user.cfg.in (INPUT): Add new header. libstdc++-v3/include/Makefile.am

[PATCH] libstdc++: Add c++2a

2020-10-21 Thread Thomas Rodgers
From: Thomas Rodgers libstdc++/Changelog: libstdc++-v3/doc/doxygen/user.cfg.in (INPUT): Add new header. libstdc++-v3/include/Makefile.am (std_headers): Add new header. libstdc++-v3/include/Makefile.in: Regenerate. libstdc++-v3/include/precompiled/stdc++.h: Include

Re: [PATCH] libstdc++: Add c++2a

2020-10-21 Thread Thomas Rodgers
> On Oct 21, 2020, at 10:34 AM, Jonathan Wakely wrote: > > On 21/10/20 09:53 -0700, Thomas Rodgers wrote: >> From: Thomas Rodgers >> >> libstdc++/Changelog: >> libstdc++-v3/doc/doxygen/user.cfg.in (INPUT): Add new header. >> libstdc++-v3/inc

[PATCH] libstdc++: Implement C++20 features for

2020-10-26 Thread Thomas Rodgers
From: Thomas Rodgers New ctors and ::view() accessor for - * basic_stingbuf * basic_istringstream * basic_ostringstream * basic_stringstreamm New ::get_allocator() accessor for basic_stringbuf. libstdc++-v3/ChangeLog: * acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20

[PATCH] libstdc++: Add C++2a synchronization support

2020-10-26 Thread Thomas Rodgers
From: Thomas Rodgers Add support for - * atomic_flag::wait/notify_one/notify_all * atomic::wait/notify_one/notify_all * counting_semaphore * binary_semaphore * latch libstdc++-v3/ChangeLog: * include/Makefile.am (bits_headers): Add new header. * include/Makefile.in

[PATCH] libstdc++: Add c++2a

2020-10-29 Thread Thomas Rodgers
From: Thomas Rodgers Addresses latest patch feedback. Changes to also work on single threaded configurations. libstdc++/ChangeLog: libstdc++-v3/doc/doxygen/user.cfg.in (INPUT): Add new header. libstdc++-v3/include/Makefile.am (std_headers): Add new header. libstdc++-v3

Re: [PATCH 0/3] Uncontroversial improvements to C++20 wait-related implementation

2021-03-23 Thread Thomas Rodgers
On 2021-03-22 08:29, Thiago Macieira via Libstdc++ wrote: Discussion at: https://gcc.gnu.org/pipermail/libstdc++/2021-February/052043.html This patch set includes the uncontroversial parts that improve performance but don't otherwise change ABI. Please note we still need to decide on how to de

[PATCH] [libstdc++] Refactor/cleanup of atomic wait implementation

2021-03-23 Thread Thomas Rodgers
From: Thomas Rodgers * This patch addresses jwakely's previous feedback. * This patch also subsumes thiago.macie...@intel.com 's 'Uncontroversial improvements to C++20 wait-related implementation'. * This patch also changes the atomic semaphore implementation to avoi

Re: [PATCH 0/3] Uncontroversial improvements to C++20 wait-related implementation

2021-03-26 Thread Thomas Rodgers
On 2021-03-23 09:35, Jonathan Wakely wrote: On 23/03/21 09:26 -0700, Thiago Macieira via Libstdc++ wrote: On Tuesday, 23 March 2021 08:39:43 PDT Thomas Rodgers wrote: I will be submitting a new patch for the atomic.wait/barrier/latch/semaphore functionality a bit later today that subsumes

[PATCH] [libstdc++] Refactor/cleanup of atomic wait implementation

2021-04-19 Thread Thomas Rodgers
From: Thomas Rodgers This patch address jwakely's feedback from 2021-04-15. This is a substantial rewrite of the atomic wait/notify (and timed wait counterparts) implementation. The previous __platform_wait looped on EINTR however this behavior is not required by the standard.

Re: GCC 11.1 Release Candidate available from gcc.gnu.org

2021-04-21 Thread Thomas Rodgers
On 2021-04-21 05:12, Jonathan Wakely wrote: On 21/04/21 12:38 +0100, Jonathan Wakely wrote: On 20/04/21 22:12 -0700, Thomas Rodgers wrote: @@ -86,6 +88,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } +_GLIBCXX_ALWAYS_INLINE bool +_M_try_acquire() noexcept +{ + for

[PATCH] [libstdc++] Fix test timeout in stop_calback/destroy.cc

2021-04-21 Thread Thomas Rodgers
From: Thomas Rodgers A change was made to __atomic_semaphore::_S_do_try_acquire() to (ideally) let the compare_exchange reload the value of __old rather than always reloading it twice. This causes _M_acquire to spin indefinitely if the value of __old is already 0. libstdc++/ChangeLog

Re: [PATCH] [libstdc++] Fix test timeout in stop_calback/destroy.cc

2021-04-21 Thread Thomas Rodgers
On 2021-04-21 11:23, Jonathan Wakely wrote: On 21/04/21 10:10 -0700, Thomas Rodgers wrote: [...snip...] Please commit your patch to trunk, since that's what you had in your original patch before I asked you to change it (causing the bug). We should do this for gcc-11 too if an RM app

[PATCH] [libstdc++] Fix "bare" notifications dropped by waiters check

2021-04-21 Thread Thomas Rodgers
From: Thomas Rodgers NOTE - This patch also needs to be backported to gcc-11 in order for semaphore release() to work correctly on non-futex platforms. Tested sparc-sun-solaris2.11 For types that track whether or not there extant waiters (e.g. semaphore) internally, the

Re: [PATCH] [libstdc++] Fix test timeout in stop_calback/destroy.cc

2021-04-21 Thread Thomas Rodgers
On 2021-04-21 14:22, Jakub Jelinek wrote: On Wed, Apr 21, 2021 at 07:23:30PM +0100, Jonathan Wakely via Gcc-patches wrote: We should do this for gcc-11 too if an RM approves it, since acquire() is currently broken. Ok, but please commit it soon, we'll need to do a RC2 tomorrow or on Friday

Re: [PATCH] [libstdc++] Fix "bare" notifications dropped by waiters check

2021-04-22 Thread Thomas Rodgers
On 2021-04-22 02:23, Jonathan Wakely wrote: On 21/04/21 18:29 -0700, Thomas Rodgers wrote: From: Thomas Rodgers NOTE - This patch also needs to be backported to gcc-11 in order for semaphore release() to work correctly on non-futex platforms. Tested sparc-sun-solaris2.11 For types that

[PATCH] libstdc++: Fix for deadlock in std::counting_semaphore [PR100806]

2021-06-16 Thread Thomas Rodgers
This is an 'interim' fix. For now it forces all waiting threads to wake on _M_release(). This isn't exactly efficient but resolves the issue in the immediate term. libstdc++-v3/ChangeLog: libstdc++/PR100806 * include/bits/semaphore_base.h (__atomic_semaphore::_M_release():

[PATCH] libstdc++: Fix for deadlock in std::counting_semaphore [PR100806]

2021-06-16 Thread Thomas Rodgers
Same as previous version except removing the copyright notice from the test. libstdc++-v3/ChangeLog: libstdc++/PR100806 * include/bits/semaphore_base.h (__atomic_semaphore::_M_release(): Force _M_release() to wake all waiting threads. * testsuite/30_threads/semaphor

Re: [PATCH] Add support for C++2a stop_token

2019-11-14 Thread Thomas Rodgers
Tested x86_64-pc-linux-gnu, committed to trunk. Jonathan Wakely writes: > On 13/11/19 17:59 -0800, Thomas Rodgers wrote: >>+/** @file include/stop_token >>+ * This is a Standard C++ Library header. >>+ */ >>+ >>+#ifndef _GLIBCXX_STOP_TOKEN >>+#define _GL

  1   2   3   >