]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: remove unnecessary C_StdFunction 11883/head
authorJohn Spray <john.spray@redhat.com>
Wed, 9 Nov 2016 19:52:03 +0000 (19:52 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 9 Nov 2016 19:54:32 +0000 (19:54 +0000)
FunctionContext works fine and already existed.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/Mgr.cc
src/mgr/MgrClient.cc
src/mgr/MgrContext.h
src/mgr/MgrStandby.cc
src/mgr/PyModules.cc
src/mon/MgrMonitor.cc

index 653f1314418402a587679e4381a71e40acf90407..7b7f24e62ab77e297c715df718edd48f4ac40588 100644 (file)
@@ -136,7 +136,7 @@ void Mgr::background_init()
 
   finisher.start();
 
-  finisher.queue(new C_StdFunction([this](){
+  finisher.queue(new FunctionContext([this](int r){
     init();
   }));
 }
index 070de31c8e1f6db6993c9a9fc5289f3c88ee2570..157baa9b8e215a677ca2fb5e7844aad72a4a6d94 100644 (file)
@@ -229,7 +229,7 @@ void MgrClient::send_report()
   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);
   }
 
index eae7d756ae6b76fbc8fda24b8f3c8b973dc05bf3..bb469b3a2305405aa6be3ef2b6b46519ed26db86 100644 (file)
 #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:
index 0beb8937d76ca3a13992f20dce6af5e5c338bfb2..fdaea9670c0162af9e2443cc47469066b132720c 100644 (file)
@@ -118,8 +118,8 @@ void MgrStandby::send_beacon()
                                  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();
         }
   )); 
index 35b6ed0687b6a80d11863f615033a8d71907f38b..8599815363c81d99052323c34c55178c72409e36 100644 (file)
@@ -437,7 +437,7 @@ void PyModules::shutdown()
   // 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();
     }));
   }
@@ -469,7 +469,7 @@ void PyModules::notify_all(const std::string &notify_type,
     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);
     }));
   }
index 8864f327a3c7ac80dbaa67a148002c7fc684522c..ec3aaec11b21c95f3c195b70781d94a93a6b26b8 100644 (file)
@@ -268,7 +268,7 @@ void MgrMonitor::send_digests()
     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);