template <typename T>
class PrimaryLogPG::BlessedGenContext : public GenContext<T> {
PrimaryLogPGRef pg;
- GenContext<T> *c;
+ unique_ptr<GenContext<T>> c;
epoch_t e;
public:
BlessedGenContext(PrimaryLogPG *pg, GenContext<T> *c, epoch_t e)
void finish(T t) {
pg->lock();
if (pg->pg_has_reset_since(e))
- delete c;
+ c.reset();
else
- c->complete(t);
+ c.release()->complete(t);
pg->unlock();
}
};
class PrimaryLogPG::BlessedContext : public Context {
PrimaryLogPGRef pg;
- Context *c;
+ unique_ptr<Context> c;
epoch_t e;
public:
BlessedContext(PrimaryLogPG *pg, Context *c, epoch_t e)
void finish(int r) {
pg->lock();
if (pg->pg_has_reset_since(e))
- delete c;
+ c.reset();
else
- c->complete(r);
+ c.release()->complete(r);
pg->unlock();
}
};
class PG_RecoveryQueueAsync : public Context {
PGBackend::Listener *pg;
- GenContext<ThreadPool::TPHandle&> *c;
+ unique_ptr<GenContext<ThreadPool::TPHandle&>> c;
public:
PG_RecoveryQueueAsync(
PGBackend::Listener *pg,
GenContext<ThreadPool::TPHandle&> *c) : pg(pg), c(c) {}
void finish(int) {
- pg->schedule_recovery_work(c);
+ pg->schedule_recovery_work(c.release());
}
};
}