diff options
Diffstat (limited to 'src/common/ceph_context.h')
-rw-r--r-- | src/common/ceph_context.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index f1877647877..6a02d5c5bf1 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -282,10 +282,20 @@ public: void set_mon_addrs(const MonMap& mm); void set_mon_addrs(const std::vector<entity_addrvec_t>& in) { auto ptr = std::make_shared<std::vector<entity_addrvec_t>>(in); +#if defined(__GNUC__) && __GNUC__ < 12 + // workaround for GCC 11 bug atomic_store_explicit(&_mon_addrs, std::move(ptr), std::memory_order_relaxed); +#else + _mon_addrs.store(std::move(ptr), std::memory_order_relaxed); +#endif } std::shared_ptr<std::vector<entity_addrvec_t>> get_mon_addrs() const { +#if defined(__GNUC__) && __GNUC__ < 12 + // workaround for GCC 11 bug auto ptr = atomic_load_explicit(&_mon_addrs, std::memory_order_relaxed); +#else + auto ptr = _mon_addrs.load(std::memory_order_relaxed); +#endif return ptr; } @@ -306,7 +316,12 @@ private: int _crypto_inited; +#if defined(__GNUC__) && __GNUC__ < 12 + // workaround for GCC 11 bug std::shared_ptr<std::vector<entity_addrvec_t>> _mon_addrs; +#else + std::atomic<std::shared_ptr<std::vector<entity_addrvec_t>>> _mon_addrs; +#endif /* libcommon service thread. * SIGHUP wakes this thread, which then reopens logfiles */ |