Merge pull request #14658 from chardan/jfw-wip-halflife_atomic_t-baragon

librados,libradosstriper,test: migrate atomic_t to std::atomic (baragon)

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-05-25 22:29:19 -05:00 committed by GitHub
commit 6b6c14f8c7
2 changed files with 5 additions and 6 deletions

View File

@ -15,11 +15,12 @@
#ifndef CEPH_LIBRADOS_IOCTXIMPL_H
#define CEPH_LIBRADOS_IOCTXIMPL_H
#include <atomic>
#include "common/Cond.h"
#include "common/Mutex.h"
#include "common/snap_types.h"
#include "common/zipkin_trace.h"
#include "include/atomic.h"
#include "include/types.h"
#include "include/rados/librados.h"
#include "include/rados/librados.hpp"
@ -30,7 +31,7 @@
class RadosClient;
struct librados::IoCtxImpl {
atomic_t ref_cnt;
std::atomic<uint64_t> ref_cnt = { 0 };
RadosClient *client;
int64_t poolid;
snapid_t snap_seq;
@ -69,11 +70,11 @@ struct librados::IoCtxImpl {
int set_snap_write_context(snapid_t seq, vector<snapid_t>& snaps);
void get() {
ref_cnt.inc();
ref_cnt++;
}
void put() {
if (ref_cnt.dec() == 0)
if (--ref_cnt == 0)
delete this;
}

View File

@ -17,8 +17,6 @@
#include <string>
#include "include/atomic.h"
#include "include/rados/librados.h"
#include "include/rados/librados.hpp"
#include "include/radosstriper/libradosstriper.h"