From 10998a967a60e1cdd65457148972eefea971bd2e Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 16 Feb 2017 11:38:31 +0000 Subject: [PATCH] mds: replace C_VoidFn in MDSDaemon with lambdas VoidFn predates our C++11 switch. Signed-off-by: John Spray --- src/mds/MDSDaemon.cc | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 53c78111f525..b857dafaf297 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -69,28 +69,6 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << name << ' ' -/** - * Helper for simple callbacks that call a void fn with no args. - */ -class C_VoidFn : public Context -{ - typedef void (MDSDaemon::*fn_ptr)(); - protected: - MDSDaemon *mds; - fn_ptr fn; - public: - C_VoidFn(MDSDaemon *mds_, fn_ptr fn_) - : mds(mds_), fn(fn_) - { - assert(mds_); - assert(fn_); - } - - void finish(int r) override - { - (mds->*fn)(); - } -}; class MDSDaemon::C_MDS_Tick : public Context { protected: @@ -997,8 +975,8 @@ void MDSDaemon::handle_mds_map(MMDSMap *m) if (mds_rank == NULL) { mds_rank = new MDSRankDispatcher(whoami, mds_lock, clog, timer, beacon, mdsmap, messenger, monc, - new C_VoidFn(this, &MDSDaemon::respawn), - new C_VoidFn(this, &MDSDaemon::suicide)); + new FunctionContext([this](int r){respawn();}), + new FunctionContext([this](int r){suicide();})); dout(10) << __func__ << ": initializing MDS rank " << mds_rank->get_nodeid() << dendl; mds_rank->init(); -- 2.47.3