libstdc++: Use helper type for checking thread ID
authorJonathan Wakely <jwakely@redhat.com>
Wed, 11 Nov 2020 09:28:50 +0000 (09:28 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 11 Nov 2020 11:13:31 +0000 (11:13 +0000)
commit43f9e5aff06f1ca2296fdbd3141fe90ec0be1912
treefb776ac5597767d4a388a1536d6175f0ae942a4b
parentca813880dcaae71f664d8f386b1a584cfefbbd4b
libstdc++: Use helper type for checking thread ID

This encapsulates the storing and checking of the thread ID into a class
type, so that the macro _GLIBCXX_HAS_GTHREADS is only checked in one
place. The code doing the checks just calls member functions of the new
type, without caring whether that really does any work or not.

libstdc++-v3/ChangeLog:

* include/std/stop_token (_Stop_state_t::_M_requester): Define
new struct with members to store and check the thread ID.
(_Stop_state_t::_M_request_stop()): Use _M_requester._M_set().
(_Stop_state_t::_M_remove_callback(_Stop_cb*)): Use
_M_requester._M_is_current_thread().
libstdc++-v3/include/std/stop_token