diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-01-06 18:39:14 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-01-06 20:56:43 +0000 |
commit | 61da01772a3dff61cf23ba2ffba33bccb68d1063 (patch) | |
tree | fe41530662b6fea6c1819485c2bc3663f126961a /gcc/ada/rtinit.c | |
parent | 5b68fb47bd24abc2e6a65e5617f586d1c1b81d4e (diff) | |
download | gcc-61da01772a3dff61cf23ba2ffba33bccb68d1063.zip gcc-61da01772a3dff61cf23ba2ffba33bccb68d1063.tar.gz gcc-61da01772a3dff61cf23ba2ffba33bccb68d1063.tar.bz2 |
libstdc++: Refactor time_zone::_Impl::rules_counter [PR108235]
Abstract the atomic counter used to synchronize access to time_zone
infos behind a Lockable class API, and use atomic_signed_lock_free
instead of atomic<int_least32_t>, as that should be the most efficient
type. (For futex-supporting targets it makes no difference, but might
benefit other targets in future.)
The new API allows the calling code to be simpler, without needing to
repeat the same error prone preprocessor conditions in multiple places.
It also allows using template metaprogramming to decide whether to use
the atomic or a mutex, which gives us more flexibility than only using
preprocessor conditions. That allows us to choose the mutex
implementation for targets such as hppa-hp-hpux11.11 where 32-bit
atomics are not lock-free and so would introduce an unwanted dependency
on libatomic.
libstdc++-v3/ChangeLog:
PR libstdc++/108235
* src/c++20/tzdb.cc (time_zone::_Impl::RulesCounter): New class
template and partial specialization for synchronizing access to
time_zone::_Impl::infos.
(time_zone::_M_get_sys_info, reload_tzdb): Adjust uses of
rules_counter.
Diffstat (limited to 'gcc/ada/rtinit.c')
0 files changed, 0 insertions, 0 deletions