summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_coroutine.h
diff options
context:
space:
mode:
authorJesse Williamson <jwilliamson@suse.de>2017-04-26 14:26:38 +0200
committerJesse Williamson <jwilliamson@suse.de>2017-04-28 09:10:55 +0200
commit0aefb5af158e35b2bea38c8d0c31e1d2e274fdbe (patch)
tree79d81b6853680932e9097d92562c77c0b5cb4d6b /src/rgw/rgw_coroutine.h
parentMerge pull request #14831 from smithfarm/wip-stress-split (diff)
downloadceph-0aefb5af158e35b2bea38c8d0c31e1d2e274fdbe.tar.xz
ceph-0aefb5af158e35b2bea38c8d0c31e1d2e274fdbe.zip
rgw: migrate atomic_t to std::atomic<>
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
Diffstat (limited to 'src/rgw/rgw_coroutine.h')
-rw-r--r--src/rgw/rgw_coroutine.h11
1 files changed, 7 insertions, 4 deletions
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 <atomic>
+
#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<bool> going_down = { false };
map<void *, void *> waiters;
@@ -506,9 +508,9 @@ public:
class RGWCoroutinesManager {
CephContext *cct;
- atomic_t going_down;
+ std::atomic<bool> going_down = { false };
- atomic64_t run_context_count;
+ std::atomic<int64_t> run_context_count = { 0 };
map<uint64_t, set<RGWCoroutinesStack *> > run_contexts;
RWLock lock;
@@ -542,7 +544,8 @@ public:
int run(list<RGWCoroutinesStack *>& 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();
}
}