libstdc++: Refactor std::call_once internals
authorJonathan Wakely <jwakely@redhat.com>
Tue, 3 Nov 2020 19:42:07 +0000 (19:42 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 3 Nov 2020 20:03:16 +0000 (20:03 +0000)
commit9f925f3b198e210e0d124a3c69fae034f429942f
tree8663060c9f3a8a645958c05d730dcaa2702c089b
parented7f9957bbb5e899099e1ef0e5f6234c453ef7da
libstdc++: Refactor std::call_once internals

This separates the definition of std::__call_proxy into two funcions,
one for TLS and one for non-TLS, to make them easier to read. It also
replaces the __get_once_functor_lock_ptr() internal helper with a new
set_lock_ptr(unique_lock<mutex>*) function so that __once_proxy doesn't
need to call it twice.

libstdc++-v3/ChangeLog:

* src/c++11/mutex.cc [_GLIBCXX_HAVE_TLS] (__once_proxy): Define
separately for TLS targets.
[!_GLIBCXX_HAVE_TLS] (__get_once_functor_lock_ptr): Replace with ...
(set_lock_ptr): ... this. Set new value and return previous
value.
[!_GLIBCXX_HAVE_TLS] (__set_once_functor_lock_ptr): Adjust to
use set_lock_ptr.
[!_GLIBCXX_HAVE_TLS] (__once_proxy): Likewise.
libstdc++-v3/src/c++11/mutex.cc