FunctionContext works fine and already existed.
Signed-off-by: John Spray <john.spray@redhat.com>
finisher.start();
- finisher.queue(new C_StdFunction([this](){
+ finisher.queue(new FunctionContext([this](int r){
init();
}));
}
session->con->send_message(report);
if (stats_period != 0) {
- report_callback = new C_StdFunction([this](){send_report();});
+ report_callback = new FunctionContext([this](int r){send_report();});
timer.add_event_after(stats_period, report_callback);
}
#define MGR_CONTEXT_H_
#include <memory>
-#include "include/Context.h"
#include "common/ceph_json.h"
#include "mon/MonClient.h"
-class C_StdFunction : public Context
-{
-private:
- std::function<void()> fn;
-
-public:
- C_StdFunction(std::function<void()> fn_)
- : fn(fn_)
- {}
-
- void finish(int r)
- {
- fn();
- }
-};
-
class Command
{
protected:
available);
monc->send_mon_message(m);
- timer.add_event_after(g_conf->mgr_beacon_period, new C_StdFunction(
- [this](){
+ timer.add_event_after(g_conf->mgr_beacon_period, new FunctionContext(
+ [this](int r){
send_beacon();
}
));
// Signal modules to drop out of serve()
for (auto i : modules) {
auto module = i.second;
- finisher.queue(new C_StdFunction([module](){
+ finisher.queue(new FunctionContext([module](int r){
module->shutdown();
}));
}
auto module = i.second;
// Send all python calls down a Finisher to avoid blocking
// C++ code, and avoid any potential lock cycles.
- finisher.queue(new C_StdFunction([module, notify_type, notify_id](){
+ finisher.queue(new FunctionContext([module, notify_type, notify_id](int r){
module->notify(notify_type, notify_id);
}));
}
sub->session->con->send_message(mdigest);
}
- digest_callback = new C_StdFunction([this](){
+ digest_callback = new FunctionContext([this](int r){
send_digests();
});
mon->timer.add_event_after(g_conf->mon_mgr_digest_period, digest_callback);