diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-01 15:40:44 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-08 11:22:08 -0700 |
commit | d5da15259b37b7729d080133656d9c411d248017 (patch) | |
tree | 8d9d3a9c978649a52300b466663343371e40bf60 | |
parent | 5e642fae345f33fd325808922205a6b517b9b4e5 (diff) | |
download | ceph-d5da15259b37b7729d080133656d9c411d248017.tar.gz |
rgw: use shared_ptr instead of RefCountedObject
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_bucket.cc | 9 | ||||
-rw-r--r-- | src/rgw/rgw_bucket.h | 7 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index e6f985c45e4..646176e1147 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1057,12 +1057,11 @@ int RGWDataChangesLog::choose_oid(rgw_bucket& bucket) { int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { lock.Lock(); - ChangeStatus *& status = changes[bucket.name]; + ChangeStatusPtr& status = changes[bucket.name]; if (!status) { - status = new ChangeStatus; + status = ChangeStatusPtr(new ChangeStatus); } - status->get(); lock.Unlock(); utime_t now = ceph_clock_now(cct); @@ -1073,7 +1072,6 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { if (now < status->cur_expiration) { /* no need to send, recently completed */ status->lock->Unlock(); - status->put(); return 0; } @@ -1086,7 +1084,6 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { status->cond->get(); status->lock->Unlock(); - status->put(); cond->wait(); cond->put(); @@ -1122,8 +1119,6 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { status->cond = NULL; status->lock->Unlock(); - status->put(); - cond->done(); cond->put(); diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index 7c4c3d3c6cb..b8492b54a3d 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -2,6 +2,7 @@ #define CEPH_RGW_BUCKET_H #include <string> +#include <memory> #include "include/types.h" #include "rgw_common.h" @@ -258,7 +259,7 @@ class RGWDataChangesLog { Mutex lock; - struct ChangeStatus : public RefCountedObject { + struct ChangeStatus { utime_t cur_expiration; utime_t cur_sent; bool pending; @@ -274,7 +275,9 @@ class RGWDataChangesLog { } }; - map<string, ChangeStatus *> changes; + typedef std::tr1::shared_ptr<ChangeStatus> ChangeStatusPtr; + + map<string, ChangeStatusPtr> changes; public: |