[PATCH] libstdc++: Fix conformance issues in <stop_token> (PR92895)

Jonathan Wakely jwakely@redhat.com
Thu Jan 23 22:36:00 GMT 2020


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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 37910 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20200123/586fa98d/attachment.bin>


More information about the Libstdc++ mailing list