This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] libstdc++: Fix conformance issues in <stop_token> (PR92895)
- From: Thomas Rodgers <trodgers at redhat dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 Jan 2020 09:57:44 -0800
- Subject: Re: [PATCH] libstdc++: Fix conformance issues in <stop_token> (PR92895)
- References: <20200123222028.GA2969@redhat.com>
Looks good to me, ok for trunk.
Thanks.
Jonathan Wakely writes:
> Fix synchronization issues in <stop_token>. 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 request has been made and how many
> stop_source objects share ownership of the state.
>
> The synchronization with callbacks being destroyed is based on the
> implementation by Lewis Baker and Nico Josuttis. It allows the
> callback being destroyed to detect whether it's currently running, and
> if so whether on the current thread or a different one.
>
> Tom, please take a look and give a review. As discussed, the
> binary_semaphore is temporary, until we have the real thing.