]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: replace C_VoidFn in MDSDaemon with lambdas 13465/head
authorJohn Spray <john.spray@redhat.com>
Thu, 16 Feb 2017 11:38:31 +0000 (11:38 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 16 Feb 2017 21:21:54 +0000 (21:21 +0000)
VoidFn predates our C++11 switch.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSDaemon.cc

index 53c78111f52564fd3c1218b43199cf32aaef2c86..b857dafaf297f7575558fea36f963ed3d4d9653d 100644 (file)
 #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();