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 2014/01/14 21:04:58 UTC

[07/15] git commit: Replaced 'std::tr1' with 'lambda' and 'memory' in Mesos.

Replaced 'std::tr1' with 'lambda' and 'memory' in Mesos.

At this point we can compile Mesos for C++11 with gcc 4.8.

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


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

Branch: refs/heads/master
Commit: 70aeb47d05c9689cc3406b4f129d8f3456bfd6a8
Parents: 89eec05
Author: Benjamin Hindman <be...@gmail.com>
Authored: Mon Dec 30 11:30:07 2013 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Tue Jan 14 12:00:39 2014 -0800

----------------------------------------------------------------------
 src/Makefile.am                      |  4 ++--
 src/common/thread.hpp                | 10 +++++-----
 src/examples/long_lived_executor.cpp |  9 ++++-----
 src/master/detector.cpp              |  3 ---
 src/master/http.cpp                  |  5 +++--
 src/master/master.cpp                |  5 +++--
 src/master/master.hpp                |  5 ++---
 src/slave/slave.hpp                  |  2 --
 src/tests/zookeeper.cpp              |  4 +---
 src/tests/zookeeper.hpp              |  4 +---
 10 files changed, 21 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 150aafb..4f04dc6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -748,8 +748,8 @@ $(MESOS_EGG): python/setup.py $(srcdir)/python/src/mesos.py		\
 	  $(MKDIR_P) python/src;					\
 	  cp -pf $(srcdir)/python/src/mesos.py python/src;		\
 	fi
-	@LIBS="$(LIBS)" PYTHONPATH=$(DISTRIBUTE_EGG)			\
-	  $(PYTHON) python/setup.py bdist_egg
+	@LIBS="$(LIBS)" CC="$(CC)" CXX="$(CXX)"				\
+	  PYTHONPATH=$(DISTRIBUTE_EGG) $(PYTHON) python/setup.py bdist_egg
 
 CLEANFILES += $(MESOS_EGG) python/build/temp.*/native/*.o python/build/lib.*/*
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/common/thread.hpp
----------------------------------------------------------------------
diff --git a/src/common/thread.hpp b/src/common/thread.hpp
index 7808b81..7e48724 100644
--- a/src/common/thread.hpp
+++ b/src/common/thread.hpp
@@ -3,7 +3,7 @@
 
 #include <pthread.h>
 
-#include <tr1/functional>
+#include <stout/lambda.hpp>
 
 // Provides a simple threading facility for starting a thread to run
 // an arbitrary function. No mechanism for returning a value from the
@@ -14,17 +14,17 @@ namespace thread {
 
 void* __run(void* arg)
 {
-  std::tr1::function<void(void)>* function =
-    reinterpret_cast<std::tr1::function<void(void)>*>(arg);
+  lambda::function<void(void)>* function =
+    reinterpret_cast<lambda::function<void(void)>*>(arg);
   (*function)();
   delete function;
   return 0;
 }
 
 
-bool start(const std::tr1::function<void(void)>& f, bool detach = false)
+bool start(const lambda::function<void(void)>& f, bool detach = false)
 {
-  std::tr1::function<void(void)>* __f = new std::tr1::function<void(void)>(f);
+  lambda::function<void(void)>* __f = new lambda::function<void(void)>(f);
 
   pthread_t t;
   if (pthread_create(&t, NULL, __run, __f) != 0) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/examples/long_lived_executor.cpp
----------------------------------------------------------------------
diff --git a/src/examples/long_lived_executor.cpp b/src/examples/long_lived_executor.cpp
index 3fcee6c..d9b7fa1 100644
--- a/src/examples/long_lived_executor.cpp
+++ b/src/examples/long_lived_executor.cpp
@@ -22,11 +22,10 @@
 #include <cstdlib>
 #include <iostream>
 
-#include <tr1/functional>
-
 #include <mesos/executor.hpp>
 
 #include <stout/duration.hpp>
+#include <stout/lambda.hpp>
 #include <stout/os.hpp>
 
 using namespace mesos;
@@ -50,7 +49,7 @@ void run(ExecutorDriver* driver, const TaskInfo& task)
 
 void* start(void* arg)
 {
-  std::tr1::function<void(void)>* thunk = (std::tr1::function<void(void)>*) arg;
+  lambda::function<void(void)>* thunk = (lambda::function<void(void)>*) arg;
   (*thunk)();
   delete thunk;
   return NULL;
@@ -82,8 +81,8 @@ public:
   {
     cout << "Starting task " << task.task_id().value() << endl;
 
-    std::tr1::function<void(void)>* thunk =
-      new std::tr1::function<void(void)>(std::tr1::bind(&run, driver, task));
+    lambda::function<void(void)>* thunk =
+      new lambda::function<void(void)>(lambda::bind(&run, driver, task));
 
     pthread_t pthread;
     if (pthread_create(&pthread, NULL, &start, thunk) != 0) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/master/detector.cpp
----------------------------------------------------------------------
diff --git a/src/master/detector.cpp b/src/master/detector.cpp
index 7b437ac..532e048 100644
--- a/src/master/detector.cpp
+++ b/src/master/detector.cpp
@@ -19,9 +19,6 @@
 #include <set>
 #include <string>
 
-#include <tr1/functional>
-#include <tr1/memory> // TODO(benh): Replace shared_ptr with unique_ptr.
-
 #include <process/defer.hpp>
 #include <process/dispatch.hpp>
 #include <process/future.hpp>

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index d7cd89f..5eee60f 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -29,6 +29,7 @@
 
 #include <stout/foreach.hpp>
 #include <stout/json.hpp>
+#include <stout/memory.hpp>
 #include <stout/net.hpp>
 #include <stout/numify.hpp>
 #include <stout/os.hpp>
@@ -447,7 +448,7 @@ Future<Response> Master::Http::state(const Request& request)
   {
     JSON::Array array;
 
-    foreach (const std::tr1::shared_ptr<Framework>& framework,
+    foreach (const memory::shared_ptr<Framework>& framework,
              master.completedFrameworks) {
       array.values.push_back(model(*framework));
     }
@@ -538,7 +539,7 @@ Future<Response> Master::Http::tasks(const Request& request)
   foreachvalue (Framework* framework, master.frameworks) {
     frameworks.push_back(framework);
   }
-  foreach (const std::tr1::shared_ptr<Framework>& framework,
+  foreach (const memory::shared_ptr<Framework>& framework,
            master.completedFrameworks) {
     frameworks.push_back(framework.get());
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 38c5532..fa1277a 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -28,6 +28,7 @@
 
 #include <stout/check.hpp>
 #include <stout/lambda.hpp>
+#include <stout/memory.hpp>
 #include <stout/multihashmap.hpp>
 #include <stout/nothing.hpp>
 #include <stout/os.hpp>
@@ -54,7 +55,7 @@ using std::vector;
 
 using process::wait; // Necessary on some OS's to disambiguate.
 
-using std::tr1::shared_ptr;
+using memory::shared_ptr;
 
 namespace mesos {
 namespace internal {
@@ -2540,7 +2541,7 @@ void Master::removeFramework(Framework* framework)
   framework->unregisteredTime = Clock::now();
 
   // The completedFramework buffer now owns the framework pointer.
-  completedFrameworks.push_back(std::tr1::shared_ptr<Framework>(framework));
+  completedFrameworks.push_back(shared_ptr<Framework>(framework));
 
   CHECK(roles.contains(framework->info.role()))
     << "Unknown role " << framework->info.role()

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 95b9cec..10feb93 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -23,8 +23,6 @@
 #include <string>
 #include <vector>
 
-#include <tr1/functional>
-
 #include <boost/circular_buffer.hpp>
 
 #include <mesos/resources.hpp>
@@ -37,6 +35,7 @@
 #include <stout/foreach.hpp>
 #include <stout/hashmap.hpp>
 #include <stout/hashset.hpp>
+#include <stout/memory.hpp>
 #include <stout/multihashmap.hpp>
 #include <stout/option.hpp>
 
@@ -355,7 +354,7 @@ private:
   // Authenticated frameworks keyed by framework's PID.
   hashset<UPID> authenticated;
 
-  boost::circular_buffer<std::tr1::shared_ptr<Framework> > completedFrameworks;
+  boost::circular_buffer<memory::shared_ptr<Framework> > completedFrameworks;
 
   int64_t nextFrameworkId; // Used to give each framework a unique ID.
   int64_t nextOfferId;     // Used to give each slot offer a unique ID.

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index b00f970..34edef2 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -23,8 +23,6 @@
 #include <string>
 #include <vector>
 
-#include <tr1/functional>
-
 #include <boost/circular_buffer.hpp>
 
 #include <mesos/resources.hpp>

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/tests/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/tests/zookeeper.cpp b/src/tests/zookeeper.cpp
index 8bb4901..8462f1f 100644
--- a/src/tests/zookeeper.cpp
+++ b/src/tests/zookeeper.cpp
@@ -22,8 +22,6 @@
 
 #include <queue>
 
-#include <tr1/functional>
-
 #include <jvm/jvm.hpp>
 
 #include <jvm/org/apache/log4j.hpp>
@@ -158,7 +156,7 @@ ZooKeeperTest::TestWatcher::awaitEvent()
 
 ZooKeeperTest::TestWatcher::Event
 ZooKeeperTest::TestWatcher::awaitEvent(
-    const std::tr1::function<bool(Event)>& matches)
+    const lambda::function<bool(Event)>& matches)
 {
   while (true) {
     Event event = awaitEvent();

http://git-wip-us.apache.org/repos/asf/mesos/blob/70aeb47d/src/tests/zookeeper.hpp
----------------------------------------------------------------------
diff --git a/src/tests/zookeeper.hpp b/src/tests/zookeeper.hpp
index 1bc38c2..48844e2 100644
--- a/src/tests/zookeeper.hpp
+++ b/src/tests/zookeeper.hpp
@@ -25,8 +25,6 @@
 
 #include <queue>
 
-#include <tr1/functional>
-
 #include <stout/duration.hpp>
 
 #include "tests/zookeeper_test_server.hpp"
@@ -104,7 +102,7 @@ public:
     void awaitCreated(const std::string& path);
 
     // Blocks until an event is fired matching the given predicate.
-    Event awaitEvent(const std::tr1::function<bool(Event)>& matches);
+    Event awaitEvent(const lambda::function<bool(Event)>& matches);
 
     // Blocks until an event is fired.
     Event awaitEvent();