You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/05/18 23:17:34 UTC

mesos git commit: Update some existing lambdas to meet style guide.

Repository: mesos
Updated Branches:
  refs/heads/master f3691eafa -> d46c0d7eb


Update some existing lambdas to meet style guide.

Review: https://reviews.apache.org/r/34017


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d46c0d7e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d46c0d7e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d46c0d7e

Branch: refs/heads/master
Commit: d46c0d7eb1295ef4a3a2494ca2f323c067f91f45
Parents: f3691ea
Author: haosdent huang <ha...@gmail.com>
Authored: Mon May 18 14:16:26 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Mon May 18 14:17:28 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp          | 21 +++++++++------------
 3rdparty/libprocess/src/tests/benchmarks.cpp | 10 +++-------
 2 files changed, 12 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d46c0d7e/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 588bd3e..e3de3cd 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -194,17 +194,6 @@ private:
       delete future;
     }
 
-    // Helper for cleaning up a response (i.e., closing any open Pipes
-    // in the event Response::type is PIPE).
-    static void cleanup(const Response& response)
-    {
-      if (response.type == Response::PIPE) {
-        CHECK_SOME(response.reader);
-        http::Pipe::Reader reader = response.reader.get(); // Remove const.
-        reader.close();
-      }
-    }
-
     const Request request; // Make a copy.
     Future<Response>* future;
   };
@@ -960,7 +949,15 @@ HttpProxy::~HttpProxy()
     // But it might have already been ready. In general, we need to
     // wait until this future is potentially ready in order to attempt
     // to close a pipe if one exists.
-    item->future->onReady(lambda::bind(&Item::cleanup, lambda::_1));
+    item->future->onReady([](const Response& response) {
+      // Cleaning up a response (i.e., closing any open Pipes in the
+      // event Response::type is PIPE).
+      if (response.type == Response::PIPE) {
+        CHECK_SOME(response.reader);
+        http::Pipe::Reader reader = response.reader.get(); // Remove const.
+        reader.close();
+      }
+    });
 
     items.pop();
     delete item;

http://git-wip-us.apache.org/repos/asf/mesos/blob/d46c0d7e/3rdparty/libprocess/src/tests/benchmarks.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/benchmarks.cpp b/3rdparty/libprocess/src/tests/benchmarks.cpp
index 0d67148..49d96ea 100644
--- a/3rdparty/libprocess/src/tests/benchmarks.cpp
+++ b/3rdparty/libprocess/src/tests/benchmarks.cpp
@@ -136,7 +136,9 @@ private:
     }
 
     return _run()
-      .then(lambda::bind(&Self::__run, lambda::_1));
+      .then([](const Duration& duration) -> Future<http::Response> {
+        return http::OK(stringify(duration));
+      });
   }
 
   Future<Duration> _run()
@@ -153,12 +155,6 @@ private:
     return duration->future();
   }
 
-  // TODO(jmlvanre): convert to c++11 lambda.
-  static Future<http::Response> __run(const Duration& duration)
-  {
-    return http::OK(stringify(duration));
-  }
-
   void pong(const UPID& from, const string& body)
   {
     ++responses;