File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -282,10 +282,20 @@ class CephContext {
282282 void set_mon_addrs (const MonMap& mm);
283283 void set_mon_addrs (const std::vector<entity_addrvec_t >& in) {
284284 auto ptr = std::make_shared<std::vector<entity_addrvec_t >>(in);
285+ #if defined(__GNUC__) && __GNUC__ < 12
286+ // workaround for GCC 11 bug
285287 atomic_store_explicit (&_mon_addrs, std::move (ptr), std::memory_order_relaxed);
288+ #else
289+ _mon_addrs.store (std::move (ptr), std::memory_order_relaxed);
290+ #endif
286291 }
287292 std::shared_ptr<std::vector<entity_addrvec_t >> get_mon_addrs () const {
293+ #if defined(__GNUC__) && __GNUC__ < 12
294+ // workaround for GCC 11 bug
288295 auto ptr = atomic_load_explicit (&_mon_addrs, std::memory_order_relaxed);
296+ #else
297+ auto ptr = _mon_addrs.load (std::memory_order_relaxed);
298+ #endif
289299 return ptr;
290300 }
291301
@@ -306,7 +316,12 @@ class CephContext {
306316
307317 int _crypto_inited;
308318
319+ #if defined(__GNUC__) && __GNUC__ < 12
320+ // workaround for GCC 11 bug
309321 std::shared_ptr<std::vector<entity_addrvec_t >> _mon_addrs;
322+ #else
323+ std::atomic<std::shared_ptr<std::vector<entity_addrvec_t >>> _mon_addrs;
324+ #endif
310325
311326 /* libcommon service thread.
312327 * SIGHUP wakes this thread, which then reopens logfiles */
You can’t perform that action at this time.
0 commit comments