Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
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);
if (now < status->cur_expiration) {
/* no need to send, recently completed */
status->lock->Unlock();
- status->put();
return 0;
}
status->cond->get();
status->lock->Unlock();
- status->put();
cond->wait();
cond->put();
status->cond = NULL;
status->lock->Unlock();
- status->put();
-
cond->done();
cond->put();
#define CEPH_RGW_BUCKET_H
#include <string>
+#include <memory>
#include "include/types.h"
#include "rgw_common.h"
Mutex lock;
- struct ChangeStatus : public RefCountedObject {
+ struct ChangeStatus {
utime_t cur_expiration;
utime_t cur_sent;
bool pending;
}
};
- map<string, ChangeStatus *> changes;
+ typedef std::tr1::shared_ptr<ChangeStatus> ChangeStatusPtr;
+
+ map<string, ChangeStatusPtr> changes;
public: