From 0aefb5af158e35b2bea38c8d0c31e1d2e274fdbe Mon Sep 17 00:00:00 2001 From: Jesse Williamson Date: Wed, 26 Apr 2017 05:26:38 -0700 Subject: rgw: migrate atomic_t to std::atomic<> Signed-off-by: Jesse Williamson --- src/rgw/rgw_coroutine.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/rgw/rgw_coroutine.h') diff --git a/src/rgw/rgw_coroutine.h b/src/rgw/rgw_coroutine.h index 821ff55889a..66afa74b375 100644 --- a/src/rgw/rgw_coroutine.h +++ b/src/rgw/rgw_coroutine.h @@ -22,6 +22,8 @@ #include "rgw_common.h" #include "rgw_boost_asio_coroutine.h" +#include + #define RGW_ASYNC_OPS_MGR_WINDOW 100 class RGWCoroutinesStack; @@ -39,7 +41,7 @@ class RGWCompletionManager : public RefCountedObject { SafeTimer timer; - atomic_t going_down; + std::atomic going_down = { false }; map waiters; @@ -506,9 +508,9 @@ public: class RGWCoroutinesManager { CephContext *cct; - atomic_t going_down; + std::atomic going_down = { false }; - atomic64_t run_context_count; + std::atomic run_context_count = { 0 }; map > run_contexts; RWLock lock; @@ -542,7 +544,8 @@ public: int run(list& ops); int run(RGWCoroutine *op); void stop() { - if (going_down.inc() == 1) { + bool expected = false; + if (going_down.compare_exchange_strong(expected, true)) { completion_mgr->go_down(); } } -- cgit v1.2.3