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/04/26 21:43:34 UTC
[01/10] mesos git commit: Removed pre-C++11 codepath in stout.
Repository: mesos
Updated Branches:
refs/heads/master b57a76f8d -> d3dfbd9bc
Removed pre-C++11 codepath in stout.
Review: https://reviews.apache.org/r/33560
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d19a9d57
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d19a9d57
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d19a9d57
Branch: refs/heads/master
Commit: d19a9d570c19597c4482ca014f42be3237662e6a
Parents: b57a76f
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:21:17 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:21:17 2015 -0700
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/format.hpp | 5 -----
.../3rdparty/stout/include/stout/lambda.hpp | 16 ++++------------
.../3rdparty/stout/include/stout/memory.hpp | 11 +++--------
.../3rdparty/stout/include/stout/tuple.hpp | 10 ----------
4 files changed, 7 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d19a9d57/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp
index e0b60fe..abe1a1d 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp
@@ -18,12 +18,7 @@
#include <stdio.h> // For 'vasprintf'.
#include <string>
-
-#if __cplusplus >= 201103L
#include <type_traits> // For 'is_pod'.
-#else // __cplusplus >= 201103L
-#include <tr1/type_traits> // For 'is_pod'.
-#endif // __cplusplus >= 201103L
#include "error.hpp"
#include "try.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/d19a9d57/3rdparty/libprocess/3rdparty/stout/include/stout/lambda.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/lambda.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/lambda.hpp
index d75f0f1..6cbb2ac 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/lambda.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/lambda.hpp
@@ -14,26 +14,18 @@
#ifndef __STOUT_LAMBDA_HPP__
#define __STOUT_LAMBDA_HPP__
-#if __cplusplus >= 201103L
#include <functional>
+
namespace lambda {
+
using std::bind;
using std::cref;
using std::function;
using std::ref;
using std::result_of;
+
using namespace std::placeholders;
+
} // namespace lambda {
-#else // __cplusplus >= 201103L
-#include <tr1/functional>
-namespace lambda {
-using std::tr1::cref;
-using std::tr1::bind;
-using std::tr1::function;
-using std::tr1::ref;
-using std::tr1::result_of;
-using namespace std::tr1::placeholders;
-} // namespace lambda {
-#endif // __cplusplus >= 201103L
#endif // __STOUT_LAMBDA_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/d19a9d57/3rdparty/libprocess/3rdparty/stout/include/stout/memory.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/memory.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/memory.hpp
index deb8df3..dfaef77 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/memory.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/memory.hpp
@@ -1,18 +1,13 @@
#ifndef __STOUT_MEMORY_HPP__
#define __STOUT_MEMORY_HPP__
-#if __cplusplus >= 201103L
#include <memory>
+
namespace memory {
+
using std::shared_ptr;
using std::weak_ptr;
+
} // namespace memory {
-#else // __cplusplus >= 201103L
-#include <tr1/memory>
-namespace memory {
-using std::tr1::shared_ptr;
-using std::tr1::weak_ptr;
-} // namespace memory {
-#endif // __cplusplus >= 201103L
#endif // __STOUT_MEMORY_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/d19a9d57/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp
index baa5533..4e7768f 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp
@@ -14,23 +14,13 @@
#ifndef __STOUT_TUPLE_HPP__
#define __STOUT_TUPLE_HPP__
-#if __cplusplus >= 201103L
#include <tuple>
-#else
-#include <tr1/tuple>
-#endif // __cplusplus >= 201103L
namespace tuples {
-#if __cplusplus >= 201103L
using std::tuple;
using std::make_tuple;
using std::get;
-#else // __cplusplus >= 201103L
-using std::tr1::tuple;
-using std::tr1::make_tuple;
-using std::tr1::get;
-#endif // __cplusplus >= 201103L
} // namespace tuples {
[08/10] mesos git commit: Removed from stout.
Posted by be...@apache.org.
Removed <stout/tuple.hpp> from stout.
Also required switching from 'tuples::' to 'std::'.
Review: https://reviews.apache.org/r/33567
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2666e7b9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2666e7b9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2666e7b9
Branch: refs/heads/master
Commit: 2666e7b9b5509a967e66efc3e5125fde22c83224
Parents: 9d6ffb9
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:25:42 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:25:43 2015 -0700
----------------------------------------------------------------------
.../3rdparty/stout/include/Makefile.am | 1 -
.../3rdparty/stout/include/stout/tuple.hpp | 27 --------------------
2 files changed, 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/2666e7b9/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
index 26ecb73..79239d7 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
@@ -75,7 +75,6 @@ nobase_include_HEADERS = \
stout/tests/utils.hpp \
stout/thread.hpp \
stout/try.hpp \
- stout/tuple.hpp \
stout/unreachable.hpp \
stout/utils.hpp \
stout/uuid.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/2666e7b9/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp
deleted file mode 100644
index 4e7768f..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/tuple.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __STOUT_TUPLE_HPP__
-#define __STOUT_TUPLE_HPP__
-
-#include <tuple>
-
-namespace tuples {
-
-using std::tuple;
-using std::make_tuple;
-using std::get;
-
-} // namespace tuples {
-
-#endif // __STOUT_TUPLE_HPP__
[09/10] mesos git commit: Switched from 'tuples::' to 'std::' in
libprocess.
Posted by be...@apache.org.
Switched from 'tuples::' to 'std::' in libprocess.
Review: https://reviews.apache.org/r/33568
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6b8d3267
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6b8d3267
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6b8d3267
Branch: refs/heads/master
Commit: 6b8d32672f3ea4da6a3f1a834af153dd85f126d0
Parents: 2666e7b
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:26:10 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:26:10 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/include/process/collect.hpp | 14 ++++----
3rdparty/libprocess/src/tests/process_tests.cpp | 38 ++++++++++----------
2 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6b8d3267/3rdparty/libprocess/include/process/collect.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/collect.hpp b/3rdparty/libprocess/include/process/collect.hpp
index ca220c3..1f10a92 100644
--- a/3rdparty/libprocess/include/process/collect.hpp
+++ b/3rdparty/libprocess/include/process/collect.hpp
@@ -2,6 +2,7 @@
#define __PROCESS_COLLECT_HPP__
#include <list>
+#include <tuple>
#include <process/check.hpp>
#include <process/defer.hpp>
@@ -10,7 +11,6 @@
#include <process/process.hpp>
#include <stout/lambda.hpp>
-#include <stout/tuple.hpp>
// TODO(bmahler): Move these into a futures.hpp header to group Future
// related utilities.
@@ -35,13 +35,13 @@ Future<std::list<Future<T>>> await(const std::list<Future<T>>& futures);
// typed of a tuple of futures.
// TODO(jieyu): Investigate the use of variadic templates here.
template <typename T1, typename T2>
-Future<tuples::tuple<Future<T1>, Future<T2>>> await(
+Future<std::tuple<Future<T1>, Future<T2>>> await(
const Future<T1>& future1,
const Future<T2>& future2);
template <typename T1, typename T2, typename T3>
-Future<tuples::tuple<Future<T1>, Future<T2>, Future<T3>>> await(
+Future<std::tuple<Future<T1>, Future<T2>, Future<T3>>> await(
const Future<T1>& future1,
const Future<T2>& future2,
const Future<T3>& future3);
@@ -197,7 +197,7 @@ inline Future<std::list<Future<T>>> await(
template <typename T1, typename T2>
-Future<tuples::tuple<Future<T1>, Future<T2>>> await(
+Future<std::tuple<Future<T1>, Future<T2>>> await(
const Future<T1>& future1,
const Future<T2>& future2)
{
@@ -212,12 +212,12 @@ Future<tuples::tuple<Future<T1>, Future<T2>>> await(
futures.push_back(promise2->future());
return await(futures)
- .then([=] () { return tuples::make_tuple(future1, future2); });
+ .then([=] () { return std::make_tuple(future1, future2); });
}
template <typename T1, typename T2, typename T3>
-Future<tuples::tuple<Future<T1>, Future<T2>, Future<T3>>> await(
+Future<std::tuple<Future<T1>, Future<T2>, Future<T3>>> await(
const Future<T1>& future1,
const Future<T2>& future2,
const Future<T3>& future3)
@@ -236,7 +236,7 @@ Future<tuples::tuple<Future<T1>, Future<T2>, Future<T3>>> await(
futures.push_back(promise3->future());
return await(futures)
- .then([=] () { return tuples::make_tuple(future1, future2, future3); });
+ .then([=] () { return std::make_tuple(future1, future2, future3); });
}
} // namespace process {
http://git-wip-us.apache.org/repos/asf/mesos/blob/6b8d3267/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index 7c2cb4b..b6c6c51 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -7,6 +7,7 @@
#include <string>
#include <sstream>
+#include <tuple>
#include <process/async.hpp>
#include <process/collect.hpp>
@@ -35,7 +36,6 @@
#include <stout/stringify.hpp>
#include <stout/stopwatch.hpp>
#include <stout/try.hpp>
-#include <stout/tuple.hpp>
#include "encoder.hpp"
@@ -1117,7 +1117,7 @@ TEST(Process, select)
Promise<int> promise3;
Promise<int> promise4;
- std::set<Future<int> > futures;
+ std::set<Future<int>> futures;
futures.insert(promise1.future());
futures.insert(promise2.future());
futures.insert(promise3.future());
@@ -1125,7 +1125,7 @@ TEST(Process, select)
promise1.set(42);
- Future<Future<int> > future = select(futures);
+ Future<Future<int>> future = select(futures);
AWAIT_READY(future);
AWAIT_READY(future.get());
@@ -1146,8 +1146,8 @@ TEST(Process, collect)
ASSERT_TRUE(GTEST_IS_THREADSAFE);
// First ensure an empty list functions correctly.
- std::list<Future<int> > empty;
- Future<std::list<int> > future = collect(empty);
+ std::list<Future<int>> empty;
+ Future<std::list<int>> future = collect(empty);
AWAIT_ASSERT_READY(future);
EXPECT_TRUE(future.get().empty());
@@ -1156,7 +1156,7 @@ TEST(Process, collect)
Promise<int> promise3;
Promise<int> promise4;
- std::list<Future<int> > futures;
+ std::list<Future<int>> futures;
futures.push_back(promise1.future());
futures.push_back(promise2.future());
futures.push_back(promise3.future());
@@ -1189,8 +1189,8 @@ TEST(Process, await1)
ASSERT_TRUE(GTEST_IS_THREADSAFE);
// First ensure an empty list functions correctly.
- std::list<Future<int> > empty;
- Future<std::list<Future<int> > > future = await(empty);
+ std::list<Future<int>> empty;
+ Future<std::list<Future<int>>> future = await(empty);
AWAIT_ASSERT_READY(future);
EXPECT_TRUE(future.get().empty());
@@ -1199,7 +1199,7 @@ TEST(Process, await1)
Promise<int> promise3;
Promise<int> promise4;
- std::list<Future<int> > futures;
+ std::list<Future<int>> futures;
futures.push_back(promise1.future());
futures.push_back(promise2.future());
futures.push_back(promise3.future());
@@ -1232,7 +1232,7 @@ TEST(Process, await2)
Promise<int> promise1;
Promise<bool> promise2;
- Future<tuples::tuple<Future<int>, Future<bool> > > future =
+ Future<std::tuple<Future<int>, Future<bool>>> future =
await(promise1.future(), promise2.future());
ASSERT_TRUE(future.isPending());
@@ -1244,12 +1244,12 @@ TEST(Process, await2)
AWAIT_READY(future);
- tuples::tuple<Future<int>, Future<bool> > futures = future.get();
+ std::tuple<Future<int>, Future<bool>> futures = future.get();
- ASSERT_TRUE(tuples::get<0>(futures).isReady());
- ASSERT_EQ(42, tuples::get<0>(futures).get());
+ ASSERT_TRUE(std::get<0>(futures).isReady());
+ ASSERT_EQ(42, std::get<0>(futures).get());
- ASSERT_TRUE(tuples::get<1>(futures).isFailed());
+ ASSERT_TRUE(std::get<1>(futures).isFailed());
}
@@ -1258,7 +1258,7 @@ TEST(Process, await3)
Promise<int> promise1;
Promise<bool> promise2;
- Future<tuples::tuple<Future<int>, Future<bool> > > future =
+ Future<std::tuple<Future<int>, Future<bool>>> future =
await(promise1.future(), promise2.future());
ASSERT_TRUE(future.isPending());
@@ -1270,12 +1270,12 @@ TEST(Process, await3)
AWAIT_READY(future);
- tuples::tuple<Future<int>, Future<bool> > futures = future.get();
+ std::tuple<Future<int>, Future<bool>> futures = future.get();
- ASSERT_TRUE(tuples::get<0>(futures).isReady());
- ASSERT_EQ(42, tuples::get<0>(futures).get());
+ ASSERT_TRUE(std::get<0>(futures).isReady());
+ ASSERT_EQ(42, std::get<0>(futures).get());
- ASSERT_TRUE(tuples::get<1>(futures).isDiscarded());
+ ASSERT_TRUE(std::get<1>(futures).isDiscarded());
}
[06/10] mesos git commit: Switched from 'memory::' to 'std::' in
libprocess.
Posted by be...@apache.org.
Switched from 'memory::' to 'std::' in libprocess.
Review: https://reviews.apache.org/r/33565
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b0430041
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b0430041
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b0430041
Branch: refs/heads/master
Commit: b0430041e81e5881b40bf9bc267fd7ab4c486301
Parents: 20b1626
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:24:33 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:24:36 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/include/process/event.hpp | 7 ++-
3rdparty/libprocess/include/process/future.hpp | 59 ++++++++++----------
3rdparty/libprocess/include/process/http.hpp | 14 ++---
.../include/process/metrics/counter.hpp | 5 +-
.../include/process/metrics/gauge.hpp | 5 +-
.../include/process/metrics/metric.hpp | 12 ++--
.../include/process/metrics/timer.hpp | 3 +-
3rdparty/libprocess/include/process/mutex.hpp | 10 ++--
3rdparty/libprocess/include/process/owned.hpp | 6 +-
3rdparty/libprocess/include/process/queue.hpp | 11 ++--
3rdparty/libprocess/include/process/run.hpp | 21 +++----
3rdparty/libprocess/include/process/shared.hpp | 14 ++---
.../libprocess/include/process/subprocess.hpp | 4 +-
3rdparty/libprocess/src/http.cpp | 11 ++--
3rdparty/libprocess/src/io.cpp | 18 +++---
3rdparty/libprocess/src/libev_poll.cpp | 9 +--
3rdparty/libprocess/src/process.cpp | 8 +--
17 files changed, 109 insertions(+), 108 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/event.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/event.hpp b/3rdparty/libprocess/include/process/event.hpp
index fa6beea..ad4a8f4 100644
--- a/3rdparty/libprocess/include/process/event.hpp
+++ b/3rdparty/libprocess/include/process/event.hpp
@@ -1,6 +1,8 @@
#ifndef __PROCESS_EVENT_HPP__
#define __PROCESS_EVENT_HPP__
+#include <memory> // TODO(benh): Replace shared_ptr with unique_ptr.
+
#include <process/future.hpp>
#include <process/http.hpp>
#include <process/message.hpp>
@@ -8,7 +10,6 @@
#include <stout/abort.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp> // TODO(benh): Replace shared_ptr with unique_ptr.
namespace process {
@@ -129,7 +130,7 @@ struct DispatchEvent : Event
{
DispatchEvent(
const UPID& _pid,
- const memory::shared_ptr<lambda::function<void(ProcessBase*)> >& _f,
+ const std::shared_ptr<lambda::function<void(ProcessBase*)>>& _f,
const Option<const std::type_info*>& _functionType)
: pid(_pid),
f(_f),
@@ -145,7 +146,7 @@ struct DispatchEvent : Event
const UPID pid;
// Function to get invoked as a result of this dispatch event.
- const memory::shared_ptr<lambda::function<void(ProcessBase*)>> f;
+ const std::shared_ptr<lambda::function<void(ProcessBase*)>> f;
const Option<const std::type_info*> functionType;
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/future.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/future.hpp b/3rdparty/libprocess/include/process/future.hpp
index 9d301d7..851ceab 100644
--- a/3rdparty/libprocess/include/process/future.hpp
+++ b/3rdparty/libprocess/include/process/future.hpp
@@ -6,6 +6,7 @@
#include <iostream>
#include <list>
+#include <memory> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <set>
#include <type_traits>
#include <vector>
@@ -23,7 +24,6 @@
#include <stout/duration.hpp>
#include <stout/error.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <stout/none.hpp>
#include <stout/option.hpp>
#include <stout/preprocessor.hpp>
@@ -404,7 +404,7 @@ private:
// failed, or discarded, in which case it returns false.
bool fail(const std::string& _message);
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
@@ -434,10 +434,10 @@ public:
// Converts this weak reference to a concrete future. Returns none
// if the conversion is not successful.
- Option<Future<T> > get() const;
+ Option<Future<T>> get() const;
private:
- memory::weak_ptr<typename Future<T>::Data> data;
+ std::weak_ptr<typename Future<T>::Data> data;
};
@@ -447,7 +447,7 @@ WeakFuture<T>::WeakFuture(const Future<T>& future)
template <typename T>
-Option<Future<T> > WeakFuture<T>::get() const
+Option<Future<T>> WeakFuture<T>::get() const
{
Future<T> future;
future.data = data.lock();
@@ -527,7 +527,7 @@ namespace internal {
template <typename T>
void discard(WeakFuture<T> reference)
{
- Option<Future<T> > future = reference.get();
+ Option<Future<T>> future = reference.get();
if (future.isSome()) {
Future<T> future_ = future.get();
future_.discard();
@@ -670,7 +670,7 @@ struct wrap
template <typename X>
-struct wrap<Future<X> >
+struct wrap<Future<X>>
{
typedef Future<X> type;
};
@@ -684,7 +684,7 @@ struct unwrap
template <typename X>
-struct unwrap<Future<X> >
+struct unwrap<Future<X>>
{
typedef X type;
};
@@ -693,7 +693,7 @@ struct unwrap<Future<X> >
template <typename T>
void select(
const Future<T>& future,
- memory::shared_ptr<Promise<Future<T > > > promise)
+ std::shared_ptr<Promise<Future<T>>> promise)
{
// We never fail the future associated with our promise.
assert(!promise->future().isFailed());
@@ -713,13 +713,12 @@ void select(
// Returns a future that captures any ready future in a set. Note that
// select DOES NOT capture a future that has failed or been discarded.
template <typename T>
-Future<Future<T> > select(const std::set<Future<T> >& futures)
+Future<Future<T>> select(const std::set<Future<T>>& futures)
{
- memory::shared_ptr<Promise<Future<T> > > promise(
- new Promise<Future<T> >());
+ std::shared_ptr<Promise<Future<T>>> promise(new Promise<Future<T>>());
promise->future().onDiscard(
- lambda::bind(&internal::discarded<Future<T> >, promise->future()));
+ lambda::bind(&internal::discarded<Future<T>>, promise->future()));
typename std::set<Future<T>>::iterator iterator;
for (iterator = futures.begin(); iterator != futures.end(); ++iterator) {
@@ -736,9 +735,9 @@ Future<Future<T> > select(const std::set<Future<T> >& futures)
template <typename T>
-void discard(const std::set<Future<T> >& futures)
+void discard(const std::set<Future<T>>& futures)
{
- typename std::set<Future<T> >::const_iterator iterator;
+ typename std::set<Future<T>>::const_iterator iterator;
for (iterator = futures.begin(); iterator != futures.end(); ++iterator) {
Future<T> future = *iterator; // Need a non-const copy to discard.
future.discard();
@@ -747,9 +746,9 @@ void discard(const std::set<Future<T> >& futures)
template <typename T>
-void discard(const std::list<Future<T> >& futures)
+void discard(const std::list<Future<T>>& futures)
{
- typename std::list<Future<T> >::const_iterator iterator;
+ typename std::list<Future<T>>::const_iterator iterator;
for (iterator = futures.begin(); iterator != futures.end(); ++iterator) {
Future<T> future = *iterator; // Need a non-const copy to discard.
future.discard();
@@ -760,7 +759,7 @@ void discard(const std::list<Future<T> >& futures)
template <typename T>
bool Promise<T>::discard(Future<T> future)
{
- memory::shared_ptr<typename Future<T>::Data> data = future.data;
+ std::shared_ptr<typename Future<T>::Data> data = future.data;
bool result = false;
@@ -1181,7 +1180,7 @@ namespace internal {
// Future since the compiler can't properly infer otherwise.
template <typename T, typename X>
void thenf(const lambda::function<Future<X>(const T&)>& f,
- const memory::shared_ptr<Promise<X>>& promise,
+ const std::shared_ptr<Promise<X>>& promise,
const Future<T>& future)
{
if (future.isReady()) {
@@ -1200,7 +1199,7 @@ void thenf(const lambda::function<Future<X>(const T&)>& f,
template <typename T, typename X>
void then(const lambda::function<X(const T&)>& f,
- const memory::shared_ptr<Promise<X>>& promise,
+ const std::shared_ptr<Promise<X>>& promise,
const Future<T>& future)
{
if (future.isReady()) {
@@ -1220,7 +1219,7 @@ void then(const lambda::function<X(const T&)>& f,
template <typename T>
void repair(
const lambda::function<Future<T>(const Future<T>&)>& f,
- const memory::shared_ptr<Promise<T>>& promise,
+ const std::shared_ptr<Promise<T>>& promise,
const Future<T>& future)
{
CHECK(!future.isPending());
@@ -1235,8 +1234,8 @@ void repair(
template <typename T>
void expired(
const lambda::function<Future<T>(const Future<T>&)>& f,
- const memory::shared_ptr<Latch>& latch,
- const memory::shared_ptr<Promise<T> >& promise,
+ const std::shared_ptr<Latch>& latch,
+ const std::shared_ptr<Promise<T>>& promise,
const Future<T>& future)
{
if (latch->trigger()) {
@@ -1254,8 +1253,8 @@ void expired(
template <typename T>
void after(
- const memory::shared_ptr<Latch>& latch,
- const memory::shared_ptr<Promise<T> >& promise,
+ const std::shared_ptr<Latch>& latch,
+ const std::shared_ptr<Promise<T>>& promise,
const Timer& timer,
const Future<T>& future)
{
@@ -1273,7 +1272,7 @@ template <typename T>
template <typename X>
Future<X> Future<T>::then(const lambda::function<Future<X>(const T&)>& f) const
{
- memory::shared_ptr<Promise<X>> promise(new Promise<X>());
+ std::shared_ptr<Promise<X>> promise(new Promise<X>());
lambda::function<void(const Future<T>&)> thenf =
lambda::bind(&internal::thenf<T, X>, f, promise, lambda::_1);
@@ -1293,7 +1292,7 @@ template <typename T>
template <typename X>
Future<X> Future<T>::then(const lambda::function<X(const T&)>& f) const
{
- memory::shared_ptr<Promise<X>> promise(new Promise<X>());
+ std::shared_ptr<Promise<X>> promise(new Promise<X>());
lambda::function<void(const Future<T>&)> then =
lambda::bind(&internal::then<T, X>, f, promise, lambda::_1);
@@ -1313,7 +1312,7 @@ template <typename T>
Future<T> Future<T>::repair(
const lambda::function<Future<T>(const Future<T>&)>& f) const
{
- memory::shared_ptr<Promise<T>> promise(new Promise<T>());
+ std::shared_ptr<Promise<T>> promise(new Promise<T>());
onAny(lambda::bind(&internal::repair<T>, f, promise, lambda::_1));
@@ -1334,8 +1333,8 @@ Future<T> Future<T>::after(
// TODO(benh): Using a Latch here but Once might be cleaner.
// Unfortunately, Once depends on Future so we can't easily use it
// from here.
- memory::shared_ptr<Latch> latch(new Latch());
- memory::shared_ptr<Promise<T> > promise(new Promise<T>());
+ std::shared_ptr<Latch> latch(new Latch());
+ std::shared_ptr<Promise<T>> promise(new Promise<T>());
// Set up a timer to invoke the callback if this future has not
// completed. Note that we do not pass a weak reference for this
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index 07825b2..5210ce0 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -4,6 +4,7 @@
#include <stdint.h>
#include <iosfwd>
+#include <memory>
#include <queue>
#include <sstream>
#include <string>
@@ -17,7 +18,6 @@
#include <stout/hashmap.hpp>
#include <stout/ip.hpp>
#include <stout/json.hpp>
-#include <stout/memory.hpp>
#include <stout/none.hpp>
#include <stout/nothing.hpp>
#include <stout/option.hpp>
@@ -135,9 +135,9 @@ public:
CLOSED,
};
- explicit Reader(const memory::shared_ptr<Data>& _data) : data(_data) {}
+ explicit Reader(const std::shared_ptr<Data>& _data) : data(_data) {}
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
class Writer
@@ -173,9 +173,9 @@ public:
FAILED,
};
- explicit Writer(const memory::shared_ptr<Data>& _data) : data(_data) {}
+ explicit Writer(const std::shared_ptr<Data>& _data) : data(_data) {}
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
Pipe() : data(new Data()) {}
@@ -210,7 +210,7 @@ private:
Option<Failure> failure;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
@@ -452,7 +452,7 @@ namespace path {
// books: "books"
// isbn: "0304827484"
// chapters: "chapters"
-Try<hashmap<std::string, std::string> > parse(
+Try<hashmap<std::string, std::string>> parse(
const std::string& pattern,
const std::string& path);
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/metrics/counter.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/metrics/counter.hpp b/3rdparty/libprocess/include/process/metrics/counter.hpp
index fde05ae..f9cab39 100644
--- a/3rdparty/libprocess/include/process/metrics/counter.hpp
+++ b/3rdparty/libprocess/include/process/metrics/counter.hpp
@@ -1,12 +1,11 @@
#ifndef __PROCESS_METRICS_COUNTER_HPP__
#define __PROCESS_METRICS_COUNTER_HPP__
+#include <memory>
#include <string>
#include <process/metrics/metric.hpp>
-#include <stout/memory.hpp>
-
namespace process {
namespace metrics {
@@ -64,7 +63,7 @@ private:
volatile int64_t v;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
} // namespace metrics {
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/metrics/gauge.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/metrics/gauge.hpp b/3rdparty/libprocess/include/process/metrics/gauge.hpp
index af06534..7d02cd5 100644
--- a/3rdparty/libprocess/include/process/metrics/gauge.hpp
+++ b/3rdparty/libprocess/include/process/metrics/gauge.hpp
@@ -1,14 +1,13 @@
#ifndef __PROCESS_METRICS_GAUGE_HPP__
#define __PROCESS_METRICS_GAUGE_HPP__
+#include <memory>
#include <string>
#include <process/defer.hpp>
#include <process/metrics/metric.hpp>
-#include <stout/memory.hpp>
-
namespace process {
namespace metrics {
@@ -38,7 +37,7 @@ private:
const Deferred<Future<double> (void)> f;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
} // namespace metrics {
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/metrics/metric.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/metrics/metric.hpp b/3rdparty/libprocess/include/process/metrics/metric.hpp
index 00ace49..a7be2d7 100644
--- a/3rdparty/libprocess/include/process/metrics/metric.hpp
+++ b/3rdparty/libprocess/include/process/metrics/metric.hpp
@@ -1,6 +1,7 @@
#ifndef __PROCESS_METRICS_METRIC_HPP__
#define __PROCESS_METRICS_METRIC_HPP__
+#include <memory>
#include <string>
#include <process/future.hpp>
@@ -10,7 +11,6 @@
#include <process/timeseries.hpp>
#include <stout/duration.hpp>
-#include <stout/memory.hpp>
#include <stout/option.hpp>
namespace process {
@@ -28,9 +28,9 @@ public:
return data->name;
}
- Option<Statistics<double> > statistics() const
+ Option<Statistics<double>> statistics() const
{
- Option<Statistics<double> > statistics = None();
+ Option<Statistics<double>> statistics = None();
if (data->history.isSome()) {
internal::acquire(&data->lock);
@@ -70,7 +70,7 @@ private:
{
if (window.isSome()) {
history =
- Owned<TimeSeries<double> >(new TimeSeries<double>(window.get()));
+ Owned<TimeSeries<double>>(new TimeSeries<double>(window.get()));
}
}
@@ -78,10 +78,10 @@ private:
int lock;
- Option<Owned<TimeSeries<double> > > history;
+ Option<Owned<TimeSeries<double>>> history;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
} // namespace metrics {
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/metrics/timer.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/metrics/timer.hpp b/3rdparty/libprocess/include/process/metrics/timer.hpp
index b6b55b1..b6f9fbd 100644
--- a/3rdparty/libprocess/include/process/metrics/timer.hpp
+++ b/3rdparty/libprocess/include/process/metrics/timer.hpp
@@ -1,6 +1,7 @@
#ifndef __PROCESS_METRICS_TIMER_HPP__
#define __PROCESS_METRICS_TIMER_HPP__
+#include <memory>
#include <string>
#include <process/clock.hpp>
@@ -116,7 +117,7 @@ private:
that.push(value);
}
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
} // namespace metrics {
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/mutex.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/mutex.hpp b/3rdparty/libprocess/include/process/mutex.hpp
index 3ff8955..99dd14f 100644
--- a/3rdparty/libprocess/include/process/mutex.hpp
+++ b/3rdparty/libprocess/include/process/mutex.hpp
@@ -1,13 +1,13 @@
#ifndef __PROCESS_MUTEX_HPP__
#define __PROCESS_MUTEX_HPP__
+#include <memory>
#include <queue>
#include <process/future.hpp>
#include <process/internal.hpp>
#include <process/owned.hpp>
-#include <stout/memory.hpp>
#include <stout/nothing.hpp>
namespace process {
@@ -26,7 +26,7 @@ public:
if (!data->locked) {
data->locked = true;
} else {
- Owned<Promise<Nothing> > promise(new Promise<Nothing>());
+ Owned<Promise<Nothing>> promise(new Promise<Nothing>());
data->promises.push(promise);
future = promise->future();
}
@@ -41,7 +41,7 @@ public:
// NOTE: We need to grab the promise 'date->promises.front()' but
// set it outside of the critical section because setting it might
// trigger callbacks that try to reacquire the lock.
- Owned<Promise<Nothing> > promise;
+ Owned<Promise<Nothing>> promise;
internal::acquire(&data->lock);
{
@@ -79,10 +79,10 @@ private:
bool locked;
// Represents "waiters" for this lock.
- std::queue<Owned<Promise<Nothing> > > promises;
+ std::queue<Owned<Promise<Nothing>>> promises;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
} // namespace process {
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/owned.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/owned.hpp b/3rdparty/libprocess/include/process/owned.hpp
index ad6c734..0541113 100644
--- a/3rdparty/libprocess/include/process/owned.hpp
+++ b/3rdparty/libprocess/include/process/owned.hpp
@@ -1,9 +1,9 @@
#ifndef __PROCESS_OWNED_HPP__
#define __PROCESS_OWNED_HPP__
-#include <glog/logging.h>
+#include <memory>
-#include <stout/memory.hpp>
+#include <glog/logging.h>
namespace process {
@@ -53,7 +53,7 @@ private:
T* volatile t; // The pointer 't' is volatile.
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/queue.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/queue.hpp b/3rdparty/libprocess/include/process/queue.hpp
index 0403e25..df8efc0 100644
--- a/3rdparty/libprocess/include/process/queue.hpp
+++ b/3rdparty/libprocess/include/process/queue.hpp
@@ -2,14 +2,13 @@
#define __PROCESS_QUEUE_HPP__
#include <deque>
+#include <memory>
#include <queue>
#include <process/future.hpp>
#include <process/internal.hpp>
#include <process/owned.hpp>
-#include <stout/memory.hpp>
-
namespace process {
template <typename T>
@@ -23,7 +22,7 @@ public:
// NOTE: We need to grab the promise 'date->promises.front()' but
// set it outside of the critical section because setting it might
// trigger callbacks that try to reacquire the lock.
- Owned<Promise<T> > promise;
+ Owned<Promise<T>> promise;
internal::acquire(&data->lock);
{
@@ -48,7 +47,7 @@ public:
internal::acquire(&data->lock);
{
if (data->elements.empty()) {
- data->promises.push_back(Owned<Promise<T> >(new Promise<T>()));
+ data->promises.push_back(Owned<Promise<T>>(new Promise<T>()));
future = data->promises.back()->future();
} else {
future = Future<T>(data->elements.front());
@@ -76,13 +75,13 @@ private:
int lock;
// Represents "waiters" for elements from the queue.
- std::deque<Owned<Promise<T> > > promises;
+ std::deque<Owned<Promise<T>>> promises;
// Represents elements already put in the queue.
std::queue<T> elements;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
} // namespace process {
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/run.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/run.hpp b/3rdparty/libprocess/include/process/run.hpp
index 924d31a..a0d7286 100644
--- a/3rdparty/libprocess/include/process/run.hpp
+++ b/3rdparty/libprocess/include/process/run.hpp
@@ -1,10 +1,11 @@
#ifndef __PROCESS_RUN_HPP__
#define __PROCESS_RUN_HPP__
+#include <memory> // TODO(benh): Replace shared_ptr with unique_ptr.
+
#include <process/process.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <stout/preprocessor.hpp>
namespace process {
@@ -12,11 +13,11 @@ namespace process {
namespace internal {
template <typename R>
-class ThunkProcess : public Process<ThunkProcess<R> >
+class ThunkProcess : public Process<ThunkProcess<R>>
{
public:
- ThunkProcess(memory::shared_ptr<lambda::function<R(void)> > _thunk,
- memory::shared_ptr<Promise<R> > _promise)
+ ThunkProcess(std::shared_ptr<lambda::function<R(void)>> _thunk,
+ std::shared_ptr<Promise<R>> _promise)
: thunk(_thunk),
promise(_promise) {}
@@ -29,8 +30,8 @@ protected:
}
private:
- memory::shared_ptr<lambda::function<R(void)> > thunk;
- memory::shared_ptr<Promise<R> > promise;
+ std::shared_ptr<lambda::function<R(void)>> thunk;
+ std::shared_ptr<Promise<R>> promise;
};
} // namespace internal {
@@ -39,11 +40,11 @@ private:
template <typename R>
Future<R> run(R (*method)(void))
{
- memory::shared_ptr<lambda::function<R(void)> > thunk(
+ std::shared_ptr<lambda::function<R(void)>> thunk(
new lambda::function<R(void)>(
lambda::bind(method)));
- memory::shared_ptr<Promise<R> > promise(new Promise<R>());
+ std::shared_ptr<Promise<R>> promise(new Promise<R>());
Future<R> future = promise->future();
terminate(spawn(new internal::ThunkProcess<R>(thunk, promise), true));
@@ -60,11 +61,11 @@ Future<R> run(R (*method)(void))
R (*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- memory::shared_ptr<lambda::function<R(void)> > thunk( \
+ std::shared_ptr<lambda::function<R(void)>> thunk( \
new lambda::function<R(void)>( \
lambda::bind(method, ENUM_PARAMS(N, a)))); \
\
- memory::shared_ptr<Promise<R> > promise(new Promise<R>()); \
+ std::shared_ptr<Promise<R>> promise(new Promise<R>()); \
Future<R> future = promise->future(); \
\
terminate(spawn(new internal::ThunkProcess<R>(thunk, promise), true)); \
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/shared.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/shared.hpp b/3rdparty/libprocess/include/process/shared.hpp
index 572ea2d..d80fb7f 100644
--- a/3rdparty/libprocess/include/process/shared.hpp
+++ b/3rdparty/libprocess/include/process/shared.hpp
@@ -1,12 +1,12 @@
#ifndef __PROCESS_SHARED_HPP__
#define __PROCESS_SHARED_HPP__
+#include <memory>
+
#include <glog/logging.h>
#include <process/future.hpp>
-#include <stout/memory.hpp>
-
namespace process {
// Forward declaration.
@@ -41,7 +41,7 @@ public:
// will be reset after this function is invoked. If multiple shared
// pointers pointing to the same object all want to be upgraded,
// only one of them may succeed and the rest will get failures.
- Future<Owned<T> > own();
+ Future<Owned<T>> own();
private:
struct Data
@@ -51,10 +51,10 @@ private:
T* t;
volatile bool owned;
- Promise<Owned<T> > promise;
+ Promise<Owned<T>> promise;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
@@ -143,7 +143,7 @@ void Shared<T>::swap(Shared<T>& that)
template <typename T>
-Future<Owned<T> > Shared<T>::own()
+Future<Owned<T>> Shared<T>::own()
{
// If two threads simultaneously access this object and at least one
// of them is a write, the behavior is undefined. This is similar to
@@ -157,7 +157,7 @@ Future<Owned<T> > Shared<T>::own()
return Failure("Ownership has already been transferred");
}
- Future<Owned<T> > future = data->promise.future();
+ Future<Owned<T>> future = data->promise.future();
data.reset();
return future;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/include/process/subprocess.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/subprocess.hpp b/3rdparty/libprocess/include/process/subprocess.hpp
index 5cc458a..37cab77 100644
--- a/3rdparty/libprocess/include/process/subprocess.hpp
+++ b/3rdparty/libprocess/include/process/subprocess.hpp
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -13,7 +14,6 @@
#include <stout/flags.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
#include <stout/try.hpp>
@@ -139,7 +139,7 @@ private:
Subprocess() : data(new Data()) {}
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index eed42ad..67983ee 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -10,6 +10,7 @@
#include <iomanip>
#include <ostream>
#include <map>
+#include <memory>
#include <queue>
#include <string>
#include <sstream>
@@ -133,7 +134,7 @@ bool Request::accepts(const string& encoding) const
foreach (const string& _encoding, strings::tokenize(accepted.get(), ",")) {
if (strings::startsWith(_encoding, candidate)) {
// Is there a 0 q value? Ex: 'gzip;q=0.0'.
- const map<string, vector<string> >& values =
+ const map<string, vector<string>>& values =
strings::pairs(_encoding, ";", "=");
// Look for { "q": ["0"] }.
@@ -342,7 +343,7 @@ Future<Nothing> Pipe::Writer::readerClosed()
namespace path {
-Try<hashmap<string, string> > parse(const string& pattern, const string& path)
+Try<hashmap<string, string>> parse(const string& pattern, const string& path)
{
// Split the pattern by '/' into keys.
vector<string> keys = strings::tokenize(pattern, "/");
@@ -551,7 +552,7 @@ namespace internal {
// Forward declarations.
Future<string> _convert(
Pipe::Reader reader,
- const memory::shared_ptr<string>& buffer,
+ const std::shared_ptr<string>& buffer,
const string& read);
Response __convert(
const Response& pipeResponse,
@@ -562,7 +563,7 @@ Response __convert(
// 'PIPE' response can be read completely.
Future<Response> convert(const Response& pipeResponse)
{
- memory::shared_ptr<string> buffer(new string());
+ std::shared_ptr<string> buffer(new string());
CHECK_EQ(Response::PIPE, pipeResponse.type);
CHECK_SOME(pipeResponse.reader);
@@ -577,7 +578,7 @@ Future<Response> convert(const Response& pipeResponse)
Future<string> _convert(
Pipe::Reader reader,
- const memory::shared_ptr<string>& buffer,
+ const std::shared_ptr<string>& buffer,
const string& read)
{
if (read.empty()) { // EOF.
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/src/io.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/io.cpp b/3rdparty/libprocess/src/io.cpp
index 1ec85e3..5f1d27b 100644
--- a/3rdparty/libprocess/src/io.cpp
+++ b/3rdparty/libprocess/src/io.cpp
@@ -1,3 +1,4 @@
+#include <memory>
#include <string>
#include <boost/shared_array.hpp>
@@ -7,7 +8,6 @@
#include <process/process.hpp> // For process::initialize.
#include <stout/lambda.hpp>
-#include <stout/memory.hpp>
#include <stout/nothing.hpp>
#include <stout/os.hpp>
#include <stout/try.hpp>
@@ -22,7 +22,7 @@ void read(
int fd,
void* data,
size_t size,
- const memory::shared_ptr<Promise<size_t> >& promise,
+ const std::shared_ptr<Promise<size_t>>& promise,
const Future<short>& future)
{
// Ignore this function if the read operation has been discarded.
@@ -74,7 +74,7 @@ void write(
int fd,
void* data,
size_t size,
- const memory::shared_ptr<Promise<size_t> >& promise,
+ const std::shared_ptr<Promise<size_t>>& promise,
const Future<short>& future)
{
// Ignore this function if the write operation has been discarded.
@@ -168,7 +168,7 @@ Future<size_t> read(int fd, void* data, size_t size)
{
process::initialize();
- memory::shared_ptr<Promise<size_t> > promise(new Promise<size_t>());
+ std::shared_ptr<Promise<size_t>> promise(new Promise<size_t>());
// Check the file descriptor.
Try<bool> nonblock = os::isNonblock(fd);
@@ -201,7 +201,7 @@ Future<size_t> write(int fd, void* data, size_t size)
{
process::initialize();
- memory::shared_ptr<Promise<size_t> > promise(new Promise<size_t>());
+ std::shared_ptr<Promise<size_t>> promise(new Promise<size_t>());
// Check the file descriptor.
Try<bool> nonblock = os::isNonblock(fd);
@@ -234,7 +234,7 @@ namespace internal {
Future<string> _read(
int fd,
- const memory::shared_ptr<string>& buffer,
+ const std::shared_ptr<string>& buffer,
const boost::shared_array<char>& data,
size_t length)
{
@@ -269,7 +269,7 @@ void _splice(
int to,
size_t chunk,
boost::shared_array<char> data,
- memory::shared_ptr<Promise<Nothing>> promise)
+ std::shared_ptr<Promise<Nothing>> promise)
{
// Stop splicing if a discard occured on our future.
if (promise->future().hasDiscard()) {
@@ -319,7 +319,7 @@ Future<Nothing> splice(int from, int to, size_t chunk)
// implementing internal::_splice as a chain of io::read and
// io::write calls, we use an explicit promise that we pass around
// so that we don't increase memory usage the longer that we splice.
- memory::shared_ptr<Promise<Nothing> > promise(new Promise<Nothing>());
+ std::shared_ptr<Promise<Nothing>> promise(new Promise<Nothing>());
Future<Nothing> future = promise->future();
@@ -369,7 +369,7 @@ Future<string> read(int fd)
// TODO(benh): Wrap up this data as a struct, use 'Owner'.
// TODO(bmahler): For efficiency, use a rope for the buffer.
- memory::shared_ptr<string> buffer(new string());
+ std::shared_ptr<string> buffer(new string());
boost::shared_array<char> data(new char[BUFFERED_READ_SIZE]);
return internal::_read(fd, buffer, data, BUFFERED_READ_SIZE)
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/src/libev_poll.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/libev_poll.cpp b/3rdparty/libprocess/src/libev_poll.cpp
index 324e4dd..6191be3 100644
--- a/3rdparty/libprocess/src/libev_poll.cpp
+++ b/3rdparty/libprocess/src/libev_poll.cpp
@@ -1,10 +1,11 @@
#include <ev.h>
+#include <memory>
+
#include <process/future.hpp>
#include <process/process.hpp> // For process::initialize.
#include <stout/lambda.hpp>
-#include <stout/memory.hpp>
#include "libev.hpp"
@@ -24,8 +25,8 @@ struct Poll
// An I/O watcher for checking for readability or writeability and
// an async watcher for being able to discard the polling.
struct {
- memory::shared_ptr<ev_io> io;
- memory::shared_ptr<ev_async> async;
+ std::shared_ptr<ev_io> io;
+ std::shared_ptr<ev_async> async;
} watcher;
Promise<short> promise;
@@ -77,7 +78,7 @@ namespace io {
namespace internal {
// Helper/continuation of 'poll' on future discard.
-void _poll(const memory::shared_ptr<ev_async>& async)
+void _poll(const std::shared_ptr<ev_async>& async)
{
ev_async_send(loop, async.get());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/b0430041/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 97ac09f..8ab0dbc 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -33,6 +33,7 @@
#include <iostream>
#include <list>
#include <map>
+#include <memory> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <queue>
#include <set>
#include <sstream>
@@ -68,7 +69,6 @@
#include <stout/duration.hpp>
#include <stout/foreach.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <stout/net.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
@@ -328,7 +328,7 @@ private:
map<Address, int> persists;
// Map from socket to outgoing queue.
- map<int, queue<Encoder*> > outgoing;
+ map<int, queue<Encoder*>> outgoing;
// HTTP proxies.
map<int, HttpProxy*> proxies;
@@ -2713,7 +2713,7 @@ void ProcessBase::visit(const HttpEvent& event)
if (handlers.http.count(name) > 0) {
// Create the promise to link with whatever gets returned, as well
// as a future to wait for the response.
- memory::shared_ptr<Promise<Response> > promise(new Promise<Response>());
+ std::shared_ptr<Promise<Response>> promise(new Promise<Response>());
Future<Response>* future = new Future<Response>(promise->future());
@@ -2956,7 +2956,7 @@ namespace internal {
void dispatch(
const UPID& pid,
- const memory::shared_ptr<lambda::function<void(ProcessBase*)> >& f,
+ const std::shared_ptr<lambda::function<void(ProcessBase*)>>& f,
const Option<const std::type_info*>& functionType)
{
process::initialize();
[07/10] mesos git commit: Switched from 'memory::' to 'std::' in
Mesos.
Posted by be...@apache.org.
Switched from 'memory::' to 'std::' in Mesos.
Review: https://reviews.apache.org/r/33566
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9d6ffb9d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9d6ffb9d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9d6ffb9d
Branch: refs/heads/master
Commit: 9d6ffb9d3e9aed4a73c495ca2c6585e220961836
Parents: b043004
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:25:10 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:25:17 2015 -0700
----------------------------------------------------------------------
src/linux/routing/internal.hpp | 4 +-
src/local/local.cpp | 5 +-
src/master/http.cpp | 10 +--
src/master/main.cpp | 5 +-
src/master/master.cpp | 7 +-
src/master/master.hpp | 14 ++--
src/slave/http.cpp | 3 +-
src/slave/slave.cpp | 18 ++--
src/slave/slave.hpp | 19 +++--
src/tests/cluster.hpp | 18 ++--
src/tests/master_tests.cpp | 161 ++++++++++++++++++------------------
src/tests/mesos.cpp | 35 ++++----
src/tests/mesos.hpp | 3 +-
src/tests/scheduler_tests.cpp | 2 +-
src/tests/slave_tests.cpp | 93 +++++++++++----------
15 files changed, 197 insertions(+), 200 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/linux/routing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/internal.hpp b/src/linux/routing/internal.hpp
index aa60796..7e636cd 100644
--- a/src/linux/routing/internal.hpp
+++ b/src/linux/routing/internal.hpp
@@ -30,10 +30,10 @@
#include <netlink/route/link.h>
#include <netlink/route/qdisc.h>
+#include <memory>
#include <string>
#include <stout/error.hpp>
-#include <stout/memory.hpp>
#include <stout/try.hpp>
#include "linux/routing/utils.hpp"
@@ -79,7 +79,7 @@ private:
T* object;
};
- memory::shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index ab58a4a..dda25ab 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -17,6 +17,7 @@
*/
#include <map>
+#include <memory>
#include <set>
#include <sstream>
#include <string>
@@ -33,7 +34,6 @@
#include <stout/duration.hpp>
#include <stout/exit.hpp>
#include <stout/foreach.hpp>
-#include <stout/memory.hpp>
#include <stout/os.hpp>
#include <stout/path.hpp>
#include <stout/try.hpp>
@@ -71,8 +71,6 @@
#include "state/protobuf.hpp"
#include "state/storage.hpp"
-using memory::shared_ptr;
-
using namespace mesos::internal;
using namespace mesos::internal::log;
@@ -100,6 +98,7 @@ using process::UPID;
using std::map;
using std::set;
+using std::shared_ptr;
using std::string;
using std::stringstream;
using std::vector;
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 00c22c4..fb44825 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -18,6 +18,7 @@
#include <iomanip>
#include <map>
+#include <memory>
#include <sstream>
#include <string>
#include <utility>
@@ -35,7 +36,6 @@
#include <stout/foreach.hpp>
#include <stout/json.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp>
#include <stout/net.hpp>
#include <stout/numify.hpp>
#include <stout/os.hpp>
@@ -160,7 +160,7 @@ JSON::Object model(const Framework& framework)
JSON::Array array;
array.values.reserve(framework.completedTasks.size()); // MESOS-2353.
- foreach (const memory::shared_ptr<Task>& task, framework.completedTasks) {
+ foreach (const std::shared_ptr<Task>& task, framework.completedTasks) {
array.values.push_back(model(*task));
}
@@ -500,7 +500,7 @@ Future<Response> Master::Http::state(const Request& request)
JSON::Array array;
array.values.reserve(master->frameworks.completed.size()); // MESOS-2353.
- foreach (const memory::shared_ptr<Framework>& framework,
+ foreach (const std::shared_ptr<Framework>& framework,
master->frameworks.completed) {
array.values.push_back(model(*framework));
}
@@ -747,7 +747,7 @@ Future<Response> Master::Http::tasks(const Request& request)
foreachvalue (Framework* framework, master->frameworks.registered) {
frameworks.push_back(framework);
}
- foreach (const memory::shared_ptr<Framework>& framework,
+ foreach (const std::shared_ptr<Framework>& framework,
master->frameworks.completed) {
frameworks.push_back(framework.get());
}
@@ -759,7 +759,7 @@ Future<Response> Master::Http::tasks(const Request& request)
CHECK_NOTNULL(task);
tasks.push_back(task);
}
- foreach (const memory::shared_ptr<Task>& task, framework->completedTasks) {
+ foreach (const std::shared_ptr<Task>& task, framework->completedTasks) {
tasks.push_back(task.get());
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index d141c76..18f8c31 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -18,6 +18,7 @@
#include <stdint.h>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -36,7 +37,6 @@
#include <stout/duration.hpp>
#include <stout/exit.hpp>
#include <stout/flags.hpp>
-#include <stout/memory.hpp>
#include <stout/nothing.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
@@ -78,8 +78,6 @@ using namespace mesos::internal::log;
using namespace mesos::internal::master;
using namespace zookeeper;
-using memory::shared_ptr;
-
using mesos::MasterInfo;
using mesos::modules::Anonymous;
@@ -93,6 +91,7 @@ using std::cerr;
using std::cout;
using std::endl;
using std::set;
+using std::shared_ptr;
using std::string;
using std::vector;
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index ce9d263..d42a6f3 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -23,6 +23,7 @@
#include <fstream>
#include <iomanip>
#include <list>
+#include <memory>
#include <sstream>
#include <mesos/module.hpp>
@@ -49,7 +50,6 @@
#include <stout/error.hpp>
#include <stout/ip.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp>
#include <stout/multihashmap.hpp>
#include <stout/net.hpp>
#include <stout/nothing.hpp>
@@ -84,6 +84,7 @@
#include "watcher/whitelist_watcher.hpp"
using std::list;
+using std::shared_ptr;
using std::string;
using std::vector;
@@ -106,8 +107,6 @@ using process::UPID;
using process::metrics::Counter;
-using memory::shared_ptr;
-
namespace mesos {
namespace internal {
namespace master {
@@ -1452,7 +1451,7 @@ void Master::detected(const Future<Option<MasterInfo>>& _leader)
}
-// Helper to convert authorization result to Future<Option<Error> >.
+// Helper to convert authorization result to Future<Option<Error>>.
static Future<Option<Error>> _authorize(const string& message, bool authorized)
{
if (authorized) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index bf1661a..49ee050 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <list>
+#include <memory>
#include <string>
#include <vector>
@@ -47,7 +48,6 @@
#include <stout/foreach.hpp>
#include <stout/hashmap.hpp>
#include <stout/hashset.hpp>
-#include <stout/memory.hpp>
#include <stout/multihashmap.hpp>
#include <stout/option.hpp>
@@ -102,7 +102,7 @@ public:
MasterContender* contender,
MasterDetector* detector,
const Option<Authorizer*>& authorizer,
- const Option<memory::shared_ptr<process::RateLimiter>>&
+ const Option<std::shared_ptr<process::RateLimiter>>&
slaveRemovalLimiter,
const Flags& flags = Flags());
@@ -607,7 +607,7 @@ private:
// health checks.
// NOTE: Using a 'shared_ptr' here is OK because 'RateLimiter' is
// a wrapper around libprocess process which is thread safe.
- Option<memory::shared_ptr<process::RateLimiter>> limiter;
+ Option<std::shared_ptr<process::RateLimiter>> limiter;
bool transitioning(const Option<SlaveID>& slaveId)
{
@@ -628,7 +628,7 @@ private:
Frameworks() : completed(MAX_COMPLETED_FRAMEWORKS) {}
hashmap<FrameworkID, Framework*> registered;
- boost::circular_buffer<memory::shared_ptr<Framework>> completed;
+ boost::circular_buffer<std::shared_ptr<Framework>> completed;
// Principals of frameworks keyed by PID.
// NOTE: Multiple PIDs can map to the same principal. The
@@ -678,7 +678,7 @@ private:
// thread safe.
// TODO(dhamon): This does not need to be a shared_ptr. Metrics contains
// copyable metric types only.
- memory::shared_ptr<Metrics> metrics;
+ std::shared_ptr<Metrics> metrics;
// Gauge handlers.
double _uptime_secs()
@@ -1043,7 +1043,7 @@ struct Framework
void addCompletedTask(const Task& task)
{
// TODO(adam-mesos): Check if completed task already exists.
- completedTasks.push_back(memory::shared_ptr<Task>(new Task(task)));
+ completedTasks.push_back(std::shared_ptr<Task>(new Task(task)));
}
void removeTask(Task* task)
@@ -1208,7 +1208,7 @@ struct Framework
// NOTE: We use a shared pointer for Task because clang doesn't like
// Boost's implementation of circular_buffer with Task (Boost
// attempts to do some memset's which are unsafe).
- boost::circular_buffer<memory::shared_ptr<Task>> completedTasks;
+ boost::circular_buffer<std::shared_ptr<Task>> completedTasks;
hashset<Offer*> offers; // Active offers for framework.
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index 914e7e5..f678aab 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -17,6 +17,7 @@
*/
#include <map>
+#include <memory>
#include <sstream>
#include <string>
#include <vector>
@@ -183,7 +184,7 @@ JSON::Object model(const Executor& executor)
object.values["queued_tasks"] = queued;
JSON::Array completed;
- foreach (const memory::shared_ptr<Task>& task, executor.completedTasks) {
+ foreach (const std::shared_ptr<Task>& task, executor.completedTasks) {
completed.values.push_back(model(*task));
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index e531283..c5b4847 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -24,6 +24,7 @@
#include <iomanip>
#include <list>
#include <map>
+#include <memory>
#include <set>
#include <sstream>
#include <string>
@@ -233,7 +234,7 @@ void Slave::initialize()
// Exit if there are processes running inside the cgroup - this
// indicates a prior slave (or child process) is still running.
- Try<set<pid_t> > processes = cgroups::processes(hierarchy.get(), cgroup);
+ Try<set<pid_t>> processes = cgroups::processes(hierarchy.get(), cgroup);
if (processes.isError()) {
EXIT(1) << "Failed to check for existing threads in cgroup " << cgroup
<< " for subsystem " << subsystem
@@ -598,7 +599,7 @@ Nothing Slave::detachFile(const string& path)
}
-void Slave::detected(const Future<Option<MasterInfo> >& _master)
+void Slave::detected(const Future<Option<MasterInfo>>& _master)
{
CHECK(state == DISCONNECTED ||
state == RUNNING ||
@@ -1071,8 +1072,7 @@ void Slave::doReliableRegistration(Duration maxBackoff)
VLOG(2) << "Reregistering terminated task " << task->task_id();
completedFramework_->add_tasks()->CopyFrom(*task);
}
- foreach (const memory::shared_ptr<Task>& task,
- executor->completedTasks) {
+ foreach (const std::shared_ptr<Task>& task, executor->completedTasks) {
VLOG(2) << "Reregistering completed task " << task->task_id();
completedFramework_->add_tasks()->CopyFrom(*task);
}
@@ -1185,7 +1185,7 @@ void Slave::runTask(
// executors to this framework and remove it from that list.
// TODO(brenden): Consider using stout/cache.hpp instead of boost
// circular_buffer.
- for (boost::circular_buffer<Owned<Framework> >::iterator i =
+ for (boost::circular_buffer<Owned<Framework>>::iterator i =
completedFrameworks.begin(); i != completedFrameworks.end(); ++i) {
if ((*i)->id() == frameworkId) {
framework->completedExecutors = (*i)->completedExecutors;
@@ -2642,7 +2642,7 @@ void Slave::statusUpdate(StatusUpdate update, const UPID& pid)
void Slave::_statusUpdate(
- const Option<Future<Nothing> >& future,
+ const Option<Future<Nothing>>& future,
const StatusUpdate& update,
const UPID& pid,
const ExecutorID& executorId,
@@ -2909,7 +2909,7 @@ void Slave::ping(const UPID& from, bool connected)
}
-void Slave::pingTimeout(Future<Option<MasterInfo> > future)
+void Slave::pingTimeout(Future<Option<MasterInfo>> future)
{
// It's possible that a new ping arrived since the timeout fired
// and we were unable to cancel this timeout. If this occurs, don't
@@ -3906,7 +3906,7 @@ void Slave::__recover(const Future<Nothing>& future)
// in the recovery code, to recover all slaves instead of only
// the latest slave.
const string& directory = path::join(flags.work_dir, "slaves");
- Try<list<string> > entries = os::ls(directory);
+ Try<list<string>> entries = os::ls(directory);
if (entries.isSome()) {
foreach (const string& entry, entries.get()) {
string path = path::join(directory, entry);
@@ -4648,7 +4648,7 @@ void Executor::completeTask(const TaskID& taskId)
<< "Failed to find terminated task " << taskId;
Task* task = terminatedTasks[taskId];
- completedTasks.push_back(memory::shared_ptr<Task>(task));
+ completedTasks.push_back(std::shared_ptr<Task>(task));
terminatedTasks.erase(taskId);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 1b8c512..654a869 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <list>
+#include <memory>
#include <string>
#include <vector>
@@ -192,7 +193,7 @@ public:
// Continue handling the status update after optionally updating the
// container's resources.
void _statusUpdate(
- const Option<Future<Nothing> >& future,
+ const Option<Future<Nothing>>& future,
const StatusUpdate& update,
const UPID& pid,
const ExecutorID& executorId,
@@ -247,7 +248,7 @@ public:
// Invoked whenever the detector detects a change in masters.
// Made public for testing purposes.
- void detected(const process::Future<Option<MasterInfo> >& pid);
+ void detected(const process::Future<Option<MasterInfo>>& pid);
enum State {
RECOVERING, // Slave is doing recovery.
@@ -284,7 +285,7 @@ public:
// Triggers a re-detection of the master when the slave does
// not receive a ping.
- void pingTimeout(process::Future<Option<MasterInfo> > future);
+ void pingTimeout(process::Future<Option<MasterInfo>> future);
void authenticate();
@@ -436,7 +437,7 @@ private:
hashmap<FrameworkID, Framework*> frameworks;
- boost::circular_buffer<process::Owned<Framework> > completedFrameworks;
+ boost::circular_buffer<process::Owned<Framework>> completedFrameworks;
MasterDetector* detector;
@@ -458,7 +459,7 @@ private:
StatusUpdateManager* statusUpdateManager;
// Master detection future.
- process::Future<Option<MasterInfo> > detection;
+ process::Future<Option<MasterInfo>> detection;
// Timer for triggering re-detection when no ping is received from
// the master.
@@ -482,7 +483,7 @@ private:
Authenticatee* authenticatee;
// Indicates if an authentication attempt is in progress.
- Option<Future<bool> > authenticating;
+ Option<Future<bool>> authenticating;
// Indicates if the authentication is successful.
bool authenticated;
@@ -566,7 +567,7 @@ struct Executor
// NOTE: We use a shared pointer for Task because clang doesn't like
// Boost's implementation of circular_buffer with Task (Boost
// attempts to do some memset's which are unsafe).
- boost::circular_buffer<memory::shared_ptr<Task> > completedTasks;
+ boost::circular_buffer<std::shared_ptr<Task>> completedTasks;
private:
Executor(const Executor&); // No copying.
@@ -611,13 +612,13 @@ struct Framework
UPID pid;
// Executors with pending tasks.
- hashmap<ExecutorID, hashmap<TaskID, TaskInfo> > pending;
+ hashmap<ExecutorID, hashmap<TaskID, TaskInfo>> pending;
// Current running executors.
hashmap<ExecutorID, Executor*> executors;
// Up to MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK completed executors.
- boost::circular_buffer<process::Owned<Executor> > completedExecutors;
+ boost::circular_buffer<process::Owned<Executor>> completedExecutors;
private:
Framework(const Framework&); // No copying.
Framework& operator = (const Framework&); // No assigning.
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/tests/cluster.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cluster.hpp b/src/tests/cluster.hpp
index 26f4af2..9506166 100644
--- a/src/tests/cluster.hpp
+++ b/src/tests/cluster.hpp
@@ -20,6 +20,7 @@
#define __TESTS_CLUSTER_HPP__
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -40,7 +41,6 @@
#include <stout/error.hpp>
#include <stout/foreach.hpp>
#include <stout/none.hpp>
-#include <stout/memory.hpp>
#include <stout/nothing.hpp>
#include <stout/option.hpp>
#include <stout/path.hpp>
@@ -104,11 +104,11 @@ public:
void shutdown();
// Start a new master with the provided flags and injections.
- Try<process::PID<master::Master> > start(
+ Try<process::PID<master::Master>> start(
const master::Flags& flags = master::Flags(),
const Option<mesos::master::allocator::Allocator*>& allocator = None(),
const Option<Authorizer*>& authorizer = None(),
- const Option<memory::shared_ptr<process::RateLimiter> >&
+ const Option<std::shared_ptr<process::RateLimiter>>&
slaveRemovalLimiter = None());
// Stops and cleans up a master at the specified PID.
@@ -145,7 +145,7 @@ public:
process::Owned<Authorizer> authorizer;
- Option<memory::shared_ptr<process::RateLimiter>> slaveRemovalLimiter;
+ Option<std::shared_ptr<process::RateLimiter>> slaveRemovalLimiter;
master::Master* master;
};
@@ -164,7 +164,7 @@ public:
void shutdown();
// Start a new slave with the provided flags and injections.
- Try<process::PID<slave::Slave> > start(
+ Try<process::PID<slave::Slave>> start(
const slave::Flags& flags = slave::Flags(),
const Option<slave::Containerizer*>& containerizer = None(),
const Option<MasterDetector*>& detector = None(),
@@ -253,11 +253,11 @@ inline void Cluster::Masters::shutdown()
}
-inline Try<process::PID<master::Master> > Cluster::Masters::start(
+inline Try<process::PID<master::Master>> Cluster::Masters::start(
const master::Flags& flags,
const Option<mesos::master::allocator::Allocator*>& allocator,
const Option<Authorizer*>& authorizer,
- const Option<memory::shared_ptr<process::RateLimiter>>& slaveRemovalLimiter)
+ const Option<std::shared_ptr<process::RateLimiter>>& slaveRemovalLimiter)
{
// Disallow multiple masters when not using ZooKeeper.
if (!masters.empty() && url.isNone()) {
@@ -383,7 +383,7 @@ inline Try<process::PID<master::Master> > Cluster::Masters::start(
<< ": " << duration.error();
}
- master.slaveRemovalLimiter = memory::shared_ptr<process::RateLimiter>(
+ master.slaveRemovalLimiter = std::shared_ptr<process::RateLimiter>(
new process::RateLimiter(permits.get(), duration.get()));
}
@@ -525,7 +525,7 @@ inline void Cluster::Slaves::shutdown()
}
-inline Try<process::PID<slave::Slave> > Cluster::Slaves::start(
+inline Try<process::PID<slave::Slave>> Cluster::Slaves::start(
const slave::Flags& flags,
const Option<slave::Containerizer*>& containerizer,
const Option<MasterDetector*>& detector,
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 8405105..bdfccb2 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -20,6 +20,7 @@
#include <gmock/gmock.h>
+#include <memory>
#include <string>
#include <vector>
@@ -38,7 +39,6 @@
#include <process/metrics/metrics.hpp>
#include <stout/json.hpp>
-#include <stout/memory.hpp>
#include <stout/net.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
@@ -62,8 +62,6 @@
#include "tests/mesos.hpp"
#include "tests/utils.hpp"
-using memory::shared_ptr;
-
using mesos::internal::master::Master;
using mesos::internal::master::allocator::MesosAllocatorProcess;
@@ -78,6 +76,7 @@ using process::Future;
using process::PID;
using process::Promise;
+using std::shared_ptr;
using std::string;
using std::vector;
@@ -104,14 +103,14 @@ class MasterTest : public MesosTest {};
TEST_F(MasterTest, TaskRunning)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
TestContainerizer containerizer(&exec);
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -121,7 +120,7 @@ TEST_F(MasterTest, TaskRunning)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -292,12 +291,12 @@ TEST_F(MasterTest, ShutdownFrameworkWhileTaskRunning)
TEST_F(MasterTest, KillTask)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
- Try<PID<Slave> > slave = StartSlave(&exec);
+ Try<PID<Slave>> slave = StartSlave(&exec);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -307,7 +306,7 @@ TEST_F(MasterTest, KillTask)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -370,12 +369,12 @@ TEST_F(MasterTest, KillTask)
// TASK_LOST when there are no slaves in transitionary states.
TEST_F(MasterTest, KillUnknownTask)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
- Try<PID<Slave> > slave = StartSlave(&exec);
+ Try<PID<Slave>> slave = StartSlave(&exec);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -385,7 +384,7 @@ TEST_F(MasterTest, KillUnknownTask)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -446,7 +445,7 @@ TEST_F(MasterTest, KillUnknownTask)
TEST_F(MasterTest, KillUnknownTaskSlaveInTransition)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
StandaloneMasterDetector detector(master.get());
@@ -459,7 +458,7 @@ TEST_F(MasterTest, KillUnknownTaskSlaveInTransition)
// Reuse slaveFlags so both StartSlave() use the same work_dir.
slave::Flags slaveFlags = CreateSlaveFlags();
- Try<PID<Slave> > slave = StartSlave(&exec, slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(&exec, slaveFlags);
ASSERT_SOME(slave);
// Wait for slave registration.
@@ -473,7 +472,7 @@ TEST_F(MasterTest, KillUnknownTaskSlaveInTransition)
EXPECT_CALL(sched, registered(&driver, _, _))
.WillOnce(FutureArg<1>(&frameworkId));
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -573,12 +572,12 @@ TEST_F(MasterTest, KillUnknownTaskSlaveInTransition)
TEST_F(MasterTest, StatusUpdateAck)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
- Try<PID<Slave> > slave = StartSlave(&exec);
+ Try<PID<Slave>> slave = StartSlave(&exec);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -588,7 +587,7 @@ TEST_F(MasterTest, StatusUpdateAck)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -641,7 +640,7 @@ TEST_F(MasterTest, StatusUpdateAck)
TEST_F(MasterTest, RecoverResources)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -652,7 +651,7 @@ TEST_F(MasterTest, RecoverResources)
flags.resources = Option<string>(
"cpus:2;mem:1024;disk:1024;ports:[1-10, 20-30]");
- Try<PID<Slave> > slave = StartSlave(&containerizer, flags);
+ Try<PID<Slave>> slave = StartSlave(&containerizer, flags);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -662,7 +661,7 @@ TEST_F(MasterTest, RecoverResources)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers));
@@ -761,12 +760,12 @@ TEST_F(MasterTest, RecoverResources)
TEST_F(MasterTest, FrameworkMessage)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
- Try<PID<Slave> > slave = StartSlave(&exec);
+ Try<PID<Slave>> slave = StartSlave(&exec);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -776,7 +775,7 @@ TEST_F(MasterTest, FrameworkMessage)
EXPECT_CALL(sched, registered(&schedDriver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&schedDriver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -843,7 +842,7 @@ TEST_F(MasterTest, FrameworkMessage)
TEST_F(MasterTest, MultipleExecutors)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
ExecutorInfo executor1; // Bug in gcc 4.1.*, must assign on next line.
@@ -861,7 +860,7 @@ TEST_F(MasterTest, MultipleExecutors)
TestContainerizer containerizer(execs);
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -871,7 +870,7 @@ TEST_F(MasterTest, MultipleExecutors)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -951,10 +950,10 @@ TEST_F(MasterTest, MultipleExecutors)
TEST_F(MasterTest, MasterInfo)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
MockScheduler sched;
@@ -983,12 +982,12 @@ TEST_F(MasterTest, MasterInfo)
TEST_F(MasterTest, MasterInfoOnReElection)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
StandaloneMasterDetector detector(master.get());
- Try<PID<Slave> > slave = StartSlave(&detector);
+ Try<PID<Slave>> slave = StartSlave(&detector);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1069,12 +1068,12 @@ TEST_F(WhitelistTest, WhitelistSlave)
master::Flags flags = CreateMasterFlags();
flags.whitelist = path;
- Try<PID<Master> > master = StartMaster(flags);
+ Try<PID<Master>> master = StartMaster(flags);
ASSERT_SOME(master);
slave::Flags slaveFlags = CreateSlaveFlags();
slaveFlags.hostname = hostname.get();
- Try<PID<Slave> > slave = StartSlave(slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(slaveFlags);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1084,7 +1083,7 @@ TEST_F(WhitelistTest, WhitelistSlave)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers));
@@ -1101,12 +1100,12 @@ TEST_F(WhitelistTest, WhitelistSlave)
TEST_F(MasterTest, MasterLost)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
StandaloneMasterDetector detector(master.get());
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1149,7 +1148,7 @@ TEST_F(MasterTest, MasterLost)
// all slave resources and a single task should be able to run on these.
TEST_F(MasterTest, LaunchCombinedOfferTest)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1163,7 +1162,7 @@ TEST_F(MasterTest, LaunchCombinedOfferTest)
slave::Flags flags = CreateSlaveFlags();
flags.resources = Option<string>(stringify(fullSlave));
- Try<PID<Slave> > slave = StartSlave(&containerizer, flags);
+ Try<PID<Slave>> slave = StartSlave(&containerizer, flags);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1173,7 +1172,7 @@ TEST_F(MasterTest, LaunchCombinedOfferTest)
EXPECT_CALL(sched, registered(&driver, _, _));
// Get 1st offer and use half of the slave resources to get subsequent offer.
- Future<vector<Offer> > offers1;
+ Future<vector<Offer>> offers1;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers1));
@@ -1203,7 +1202,7 @@ TEST_F(MasterTest, LaunchCombinedOfferTest)
EXPECT_CALL(sched, statusUpdate(&driver, _))
.WillOnce(FutureArg<1>(&status1));
- Future<vector<Offer> > offers2;
+ Future<vector<Offer>> offers2;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers2));
@@ -1231,7 +1230,7 @@ TEST_F(MasterTest, LaunchCombinedOfferTest)
EXPECT_CALL(sched, statusUpdate(&driver, _))
.WillOnce(FutureArg<1>(&status2));
- Future<vector<Offer> > offers3;
+ Future<vector<Offer>> offers3;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers3))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -1289,7 +1288,7 @@ TEST_F(MasterTest, LaunchCombinedOfferTest)
// Test ensures offers for launchTasks cannot span multiple slaves.
TEST_F(MasterTest, LaunchAcrossSlavesTest)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1302,7 +1301,7 @@ TEST_F(MasterTest, LaunchAcrossSlavesTest)
slave::Flags flags = CreateSlaveFlags();
flags.resources = Option<string>(stringify(fullSlave));
- Try<PID<Slave> > slave1 = StartSlave(&containerizer, flags);
+ Try<PID<Slave>> slave1 = StartSlave(&containerizer, flags);
ASSERT_SOME(slave1);
MockScheduler sched;
@@ -1311,7 +1310,7 @@ TEST_F(MasterTest, LaunchAcrossSlavesTest)
EXPECT_CALL(sched, registered(&driver, _, _));
- Future<vector<Offer> > offers1;
+ Future<vector<Offer>> offers1;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers1));
@@ -1324,7 +1323,7 @@ TEST_F(MasterTest, LaunchAcrossSlavesTest)
EXPECT_EQ(Megabytes(1024), resources1.mem().get());
// Test that offers cannot span multiple slaves.
- Future<vector<Offer> > offers2;
+ Future<vector<Offer>> offers2;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers2))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -1398,7 +1397,7 @@ TEST_F(MasterTest, LaunchAcrossSlavesTest)
// for launchTasks.
TEST_F(MasterTest, LaunchDuplicateOfferTest)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1410,7 +1409,7 @@ TEST_F(MasterTest, LaunchDuplicateOfferTest)
slave::Flags flags = CreateSlaveFlags();
flags.resources = Option<string>(stringify(fullSlave));
- Try<PID<Slave> > slave = StartSlave(&containerizer, flags);
+ Try<PID<Slave>> slave = StartSlave(&containerizer, flags);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1421,7 +1420,7 @@ TEST_F(MasterTest, LaunchDuplicateOfferTest)
// Test that same offers cannot be used more than once.
// Kill 2nd task and get offer for full slave.
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -1674,7 +1673,7 @@ TEST_F(MasterTest, RecoveredSlaveDoesNotReregister)
{
// Step 1: Start a master.
master::Flags masterFlags = CreateMasterFlags();
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
// Step 2: Start a slave.
@@ -1684,7 +1683,7 @@ TEST_F(MasterTest, RecoveredSlaveDoesNotReregister)
// Reuse slaveFlags so both StartSlave() use the same work_dir.
slave::Flags slaveFlags = this->CreateSlaveFlags();
- Try<PID<Slave> > slave = StartSlave(slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(slaveFlags);
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1750,7 +1749,7 @@ TEST_F(MasterTest, NonStrictRegistryWriteOnly)
master::Flags masterFlags = CreateMasterFlags();
masterFlags.registry_strict = false;
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
// Step 2: Start a slave.
@@ -1760,7 +1759,7 @@ TEST_F(MasterTest, NonStrictRegistryWriteOnly)
// Reuse slaveFlags so both StartSlave() use the same work_dir.
slave::Flags slaveFlags = this->CreateSlaveFlags();
- Try<PID<Slave> > slave = StartSlave(slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(slaveFlags);
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1827,14 +1826,14 @@ TEST_F(MasterTest, RateLimitRecoveredSlaveRemoval)
{
// Start a master.
master::Flags masterFlags = CreateMasterFlags();
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
Future<SlaveRegisteredMessage> slaveRegisteredMessage =
FUTURE_PROTOBUF(SlaveRegisteredMessage(), master.get(), _);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1902,7 +1901,7 @@ TEST_F(MasterTest, CancelRecoveredSlaveRemoval)
{
// Start a master.
master::Flags masterFlags = CreateMasterFlags();
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
Future<SlaveRegisteredMessage> slaveRegisteredMessage =
@@ -1911,7 +1910,7 @@ TEST_F(MasterTest, CancelRecoveredSlaveRemoval)
// Reuse slaveFlags so both StartSlave() use the same work_dir.
slave::Flags slaveFlags = CreateSlaveFlags();
- Try<PID<Slave> > slave = StartSlave(slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(slaveFlags);
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1994,7 +1993,7 @@ TEST_F(MasterTest, RecoveredSlaveReregisters)
{
// Step 1: Start a master.
master::Flags masterFlags = CreateMasterFlags();
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
// Step 2: Start a slave.
@@ -2004,7 +2003,7 @@ TEST_F(MasterTest, RecoveredSlaveReregisters)
// Reuse slaveFlags so both StartSlave() use the same work_dir.
slave::Flags slaveFlags = this->CreateSlaveFlags();
- Try<PID<Slave> > slave = StartSlave(slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(slaveFlags);
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -2150,14 +2149,14 @@ TEST_F(MasterZooKeeperTest, LostZooKeeperCluster)
TEST_F(MasterTest, OrphanTasks)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
StandaloneMasterDetector detector (master.get());
// Start a slave.
- Try<PID<Slave> > slave = StartSlave(&exec, &detector);
+ Try<PID<Slave>> slave = StartSlave(&exec, &detector);
ASSERT_SOME(slave);
// Create a task on the slave.
@@ -2318,7 +2317,7 @@ TEST_F(MasterTest, OrphanTasks)
// resource from offers so that frameworks cannot see it.
TEST_F(MasterTest, IgnoreEphemeralPortsResource)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
string resourcesWithoutEphemeralPorts =
@@ -2330,7 +2329,7 @@ TEST_F(MasterTest, IgnoreEphemeralPortsResource)
slave::Flags flags = CreateSlaveFlags();
flags.resources = resourcesWithEphemeralPorts;
- Try<PID<Slave> > slave = StartSlave(flags);
+ Try<PID<Slave>> slave = StartSlave(flags);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -2339,7 +2338,7 @@ TEST_F(MasterTest, IgnoreEphemeralPortsResource)
EXPECT_CALL(sched, registered(&driver, _, _));
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers));
@@ -2365,14 +2364,14 @@ TEST_F(MasterTest, MaxExecutorsPerSlave)
master::Flags flags = CreateMasterFlags();
flags.max_executors_per_slave = 0;
- Try<PID<Master> > master = StartMaster(flags);
+ Try<PID<Master>> master = StartMaster(flags);
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
TestContainerizer containerizer(&exec);
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -2383,7 +2382,7 @@ TEST_F(MasterTest, MaxExecutorsPerSlave)
EXPECT_CALL(sched, registered(&driver, _, _))
.WillOnce(FutureArg<2>(&masterInfo));
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.Times(0);
@@ -2407,10 +2406,10 @@ TEST_F(MasterTest, OfferTimeout)
{
master::Flags masterFlags = MesosTest::CreateMasterFlags();
masterFlags.offer_timeout = Seconds(30);
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
MockScheduler sched;
@@ -2421,8 +2420,8 @@ TEST_F(MasterTest, OfferTimeout)
EXPECT_CALL(sched, registered(&driver, _, _))
.WillOnce(FutureSatisfy(®istered));
- Future<vector<Offer> > offers1;
- Future<vector<Offer> > offers2;
+ Future<vector<Offer>> offers1;
+ Future<vector<Offer>> offers2;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers1))
.WillOnce(FutureArg<1>(&offers2));
@@ -2470,14 +2469,14 @@ TEST_F(MasterTest, OfferNotRescindedOnceUsed)
{
master::Flags masterFlags = MesosTest::CreateMasterFlags();
masterFlags.offer_timeout = Seconds(30);
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
TestContainerizer containerizer(&exec);
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -2531,14 +2530,14 @@ TEST_F(MasterTest, OfferNotRescindedOnceDeclined)
{
master::Flags masterFlags = MesosTest::CreateMasterFlags();
masterFlags.offer_timeout = Seconds(30);
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
TestContainerizer containerizer(&exec);
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -2583,7 +2582,7 @@ TEST_F(MasterTest, OfferNotRescindedOnceDeclined)
TEST_F(MasterTest, UnacknowledgedTerminalTask)
{
master::Flags masterFlags = CreateMasterFlags();
- Try<PID<Master> > master = StartMaster(masterFlags);
+ Try<PID<Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -2592,7 +2591,7 @@ TEST_F(MasterTest, UnacknowledgedTerminalTask)
slave::Flags slaveFlags = CreateSlaveFlags();
slaveFlags.resources = "cpus:1;mem:64";
- Try<PID<Slave> > slave = StartSlave(&containerizer, slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(&containerizer, slaveFlags);
ASSERT_SOME(slave);
// Launch a framework and get a task into a terminal state.
@@ -2604,8 +2603,8 @@ TEST_F(MasterTest, UnacknowledgedTerminalTask)
EXPECT_CALL(sched, registered(&driver, _, _))
.WillOnce(FutureArg<1>(&frameworkId));
- Future<vector<Offer> > offers1;
- Future<vector<Offer> > offers2;
+ Future<vector<Offer>> offers1;
+ Future<vector<Offer>> offers2;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(DoAll(FutureArg<1>(&offers1),
LaunchTasks(DEFAULT_EXECUTOR_INFO, 1, 1, 64, "*")))
@@ -2662,7 +2661,7 @@ TEST_F(MasterTest, UnacknowledgedTerminalTask)
// latest state set).
TEST_F(MasterTest, ReleaseResourcesForTerminalTaskWithPendingUpdates)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -2671,7 +2670,7 @@ TEST_F(MasterTest, ReleaseResourcesForTerminalTaskWithPendingUpdates)
slave::Flags slaveFlags = CreateSlaveFlags();
slaveFlags.resources = "cpus:1;mem:64";
- Try<PID<Slave> > slave = StartSlave(&containerizer, slaveFlags);
+ Try<PID<Slave>> slave = StartSlave(&containerizer, slaveFlags);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -2831,7 +2830,7 @@ TEST_F(MasterTest, StateEndpoint)
// state.json endpoint, if provided by the framework.
TEST_F(MasterTest, FrameworkWebUIUrl)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
FrameworkInfo framework = DEFAULT_FRAMEWORK_INFO;
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 1dde4fe..bc082e8 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -16,12 +16,12 @@
* limitations under the License.
*/
+#include <memory>
#include <string>
#include <stout/check.hpp>
#include <stout/foreach.hpp>
#include <stout/json.hpp>
-#include <stout/memory.hpp>
#include <stout/os.hpp>
#include <stout/path.hpp>
#include <stout/result.hpp>
@@ -48,8 +48,7 @@
#include "tests/flags.hpp"
#include "tests/mesos.hpp"
-using memory::shared_ptr;
-
+using std::shared_ptr;
using std::string;
using testing::_;
using testing::Invoke;
@@ -180,7 +179,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
}
-Try<PID<master::Master> > MesosTest::StartMaster(
+Try<PID<master::Master>> MesosTest::StartMaster(
const Option<master::Flags>& flags)
{
return cluster.masters.start(
@@ -188,7 +187,7 @@ Try<PID<master::Master> > MesosTest::StartMaster(
}
-Try<PID<master::Master> > MesosTest::StartMaster(
+Try<PID<master::Master>> MesosTest::StartMaster(
mesos::master::allocator::Allocator* allocator,
const Option<master::Flags>& flags)
{
@@ -198,7 +197,7 @@ Try<PID<master::Master> > MesosTest::StartMaster(
}
-Try<PID<master::Master> > MesosTest::StartMaster(
+Try<PID<master::Master>> MesosTest::StartMaster(
Authorizer* authorizer,
const Option<master::Flags>& flags)
{
@@ -221,7 +220,7 @@ Try<PID<master::Master>> MesosTest::StartMaster(
}
-Try<PID<slave::Slave> > MesosTest::StartSlave(
+Try<PID<slave::Slave>> MesosTest::StartSlave(
const Option<slave::Flags>& flags)
{
return cluster.slaves.start(
@@ -229,13 +228,13 @@ Try<PID<slave::Slave> > MesosTest::StartSlave(
}
-Try<PID<slave::Slave> > MesosTest::StartSlave(
+Try<PID<slave::Slave>> MesosTest::StartSlave(
MockExecutor* executor,
const Option<slave::Flags>& flags)
{
slave::Containerizer* containerizer = new TestContainerizer(executor);
- Try<PID<slave::Slave> > pid = StartSlave(containerizer, flags);
+ Try<PID<slave::Slave>> pid = StartSlave(containerizer, flags);
if (pid.isError()) {
delete containerizer;
@@ -248,7 +247,7 @@ Try<PID<slave::Slave> > MesosTest::StartSlave(
}
-Try<PID<slave::Slave> > MesosTest::StartSlave(
+Try<PID<slave::Slave>> MesosTest::StartSlave(
slave::Containerizer* containerizer,
const Option<slave::Flags>& flags)
{
@@ -258,7 +257,7 @@ Try<PID<slave::Slave> > MesosTest::StartSlave(
}
-Try<PID<slave::Slave> > MesosTest::StartSlave(
+Try<PID<slave::Slave>> MesosTest::StartSlave(
slave::Containerizer* containerizer,
MasterDetector* detector,
const Option<slave::Flags>& flags)
@@ -270,7 +269,7 @@ Try<PID<slave::Slave> > MesosTest::StartSlave(
}
-Try<PID<slave::Slave> > MesosTest::StartSlave(
+Try<PID<slave::Slave>> MesosTest::StartSlave(
MasterDetector* detector,
const Option<slave::Flags>& flags)
{
@@ -281,7 +280,7 @@ Try<PID<slave::Slave> > MesosTest::StartSlave(
}
-Try<PID<slave::Slave> > MesosTest::StartSlave(
+Try<PID<slave::Slave>> MesosTest::StartSlave(
MasterDetector* detector,
slave::GarbageCollector* gc,
const Option<slave::Flags>& flags)
@@ -294,14 +293,14 @@ Try<PID<slave::Slave> > MesosTest::StartSlave(
}
-Try<PID<slave::Slave> > MesosTest::StartSlave(
+Try<PID<slave::Slave>> MesosTest::StartSlave(
MockExecutor* executor,
MasterDetector* detector,
const Option<slave::Flags>& flags)
{
slave::Containerizer* containerizer = new TestContainerizer(executor);
- Try<PID<slave::Slave> > pid = cluster.slaves.start(
+ Try<PID<slave::Slave>> pid = cluster.slaves.start(
flags.isNone() ? CreateSlaveFlags() : flags.get(),
containerizer,
detector);
@@ -494,7 +493,7 @@ void ContainerizerTest<slave::MesosContainerizer>::SetUpTestCase()
if (cgroups::enabled() && user.get() == "root") {
// Clean up any testing hierarchies.
- Try<std::set<string> > hierarchies = cgroups::hierarchies();
+ Try<std::set<string>> hierarchies = cgroups::hierarchies();
ASSERT_SOME(hierarchies);
foreach (const string& hierarchy, hierarchies.get()) {
if (strings::startsWith(hierarchy, TEST_CGROUPS_HIERARCHY)) {
@@ -512,7 +511,7 @@ void ContainerizerTest<slave::MesosContainerizer>::TearDownTestCase()
if (cgroups::enabled() && user.get() == "root") {
// Clean up any testing hierarchies.
- Try<std::set<string> > hierarchies = cgroups::hierarchies();
+ Try<std::set<string>> hierarchies = cgroups::hierarchies();
ASSERT_SOME(hierarchies);
foreach (const string& hierarchy, hierarchies.get()) {
if (strings::startsWith(hierarchy, TEST_CGROUPS_HIERARCHY)) {
@@ -604,7 +603,7 @@ void ContainerizerTest<slave::MesosContainerizer>::TearDown()
foreach (const string& subsystem, subsystems) {
string hierarchy = path::join(baseHierarchy, subsystem);
- Try<std::vector<string> > cgroups = cgroups::get(hierarchy);
+ Try<std::vector<string>> cgroups = cgroups::get(hierarchy);
CHECK_SOME(cgroups);
foreach (const string& cgroup, cgroups.get()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 4294e28..19db712 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -20,6 +20,7 @@
#define __TESTS_MESOS_HPP__
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -113,7 +114,7 @@ protected:
// Starts a master with a slave removal rate limiter and flags.
virtual Try<process::PID<master::Master> > StartMaster(
- const memory::shared_ptr<MockRateLimiter>& slaveRemovalLimiter,
+ const std::shared_ptr<MockRateLimiter>& slaveRemovalLimiter,
const Option<master::Flags>& flags = None());
// TODO(bmahler): Consider adding a builder style interface, e.g.
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/tests/scheduler_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_tests.cpp b/src/tests/scheduler_tests.cpp
index 9a2f306..cbe6c91 100644
--- a/src/tests/scheduler_tests.cpp
+++ b/src/tests/scheduler_tests.cpp
@@ -18,6 +18,7 @@
#include <gmock/gmock.h>
+#include <memory>
#include <string>
#include <queue>
#include <vector>
@@ -39,7 +40,6 @@
#include <stout/json.hpp>
#include <stout/lambda.hpp>
-#include <stout/memory.hpp>
#include <stout/try.hpp>
#include <stout/uuid.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/9d6ffb9d/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index b826000..04e79ec 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -22,6 +22,7 @@
#include <algorithm>
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -34,7 +35,6 @@
#include <process/pid.hpp>
#include <process/subprocess.hpp>
-#include <stout/memory.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
#include <stout/try.hpp>
@@ -59,8 +59,6 @@
#include "tests/limiter.hpp"
#include "tests/mesos.hpp"
-using memory::shared_ptr;
-
using namespace mesos::internal::slave;
using mesos::internal::master::Master;
@@ -72,6 +70,7 @@ using process::Promise;
using process::UPID;
using std::map;
+using std::shared_ptr;
using std::string;
using std::vector;
@@ -100,7 +99,7 @@ class SlaveTest : public MesosTest {};
TEST_F(SlaveTest, ShutdownUnregisteredExecutor)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
// Need flags for 'executor_registration_timeout'.
@@ -114,7 +113,7 @@ TEST_F(SlaveTest, ShutdownUnregisteredExecutor)
MesosContainerizer::create(flags, false, &fetcher);
CHECK_SOME(containerizer);
- Try<PID<Slave> > slave = StartSlave(containerizer.get());
+ Try<PID<Slave>> slave = StartSlave(containerizer.get());
ASSERT_SOME(slave);
MockScheduler sched;
@@ -124,7 +123,7 @@ TEST_F(SlaveTest, ShutdownUnregisteredExecutor)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -196,14 +195,14 @@ TEST_F(SlaveTest, ShutdownUnregisteredExecutor)
// registering with slave, it is properly cleaned up.
TEST_F(SlaveTest, RemoveUnregisteredTerminatedExecutor)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
TestContainerizer containerizer(&exec);
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -213,7 +212,7 @@ TEST_F(SlaveTest, RemoveUnregisteredTerminatedExecutor)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -274,12 +273,12 @@ TEST_F(SlaveTest, RemoveUnregisteredTerminatedExecutor)
// command to use via the --override argument.
TEST_F(SlaveTest, CommandExecutorWithOverride)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
TestContainerizer containerizer;
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -289,7 +288,7 @@ TEST_F(SlaveTest, CommandExecutorWithOverride)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -412,7 +411,7 @@ TEST_F(SlaveTest, CommandExecutorWithOverride)
// This assumes the ability to execute '/bin/echo --author'.
TEST_F(SlaveTest, ComamndTaskWithArguments)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
// Need flags for 'executor_registration_timeout'.
@@ -425,7 +424,7 @@ TEST_F(SlaveTest, ComamndTaskWithArguments)
MesosContainerizer::create(flags, false, &fetcher);
CHECK_SOME(containerizer);
- Try<PID<Slave> > slave = StartSlave(containerizer.get());
+ Try<PID<Slave>> slave = StartSlave(containerizer.get());
ASSERT_SOME(slave);
MockScheduler sched;
@@ -435,7 +434,7 @@ TEST_F(SlaveTest, ComamndTaskWithArguments)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -540,7 +539,7 @@ TEST_F(SlaveTest, GetExecutorInfo)
// slave user (in this case, root).
TEST_F(SlaveTest, ROOT_RunTaskWithCommandInfoWithoutUser)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
// Need flags for 'executor_registration_timeout'.
@@ -553,7 +552,7 @@ TEST_F(SlaveTest, ROOT_RunTaskWithCommandInfoWithoutUser)
MesosContainerizer::create(flags, false, &fetcher);
CHECK_SOME(containerizer);
- Try<PID<Slave> > slave = StartSlave(containerizer.get());
+ Try<PID<Slave>> slave = StartSlave(containerizer.get());
ASSERT_SOME(slave);
MockScheduler sched;
@@ -563,7 +562,7 @@ TEST_F(SlaveTest, ROOT_RunTaskWithCommandInfoWithoutUser)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -640,7 +639,7 @@ TEST_F(SlaveTest, DISABLED_ROOT_RunTaskWithCommandInfoWithUser)
return;
}
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
// Need flags for 'executor_registration_timeout'.
@@ -653,7 +652,7 @@ TEST_F(SlaveTest, DISABLED_ROOT_RunTaskWithCommandInfoWithUser)
MesosContainerizer::create(flags, false, &fetcher);
CHECK_SOME(containerizer);
- Try<PID<Slave> > slave = StartSlave(containerizer.get());
+ Try<PID<Slave>> slave = StartSlave(containerizer.get());
ASSERT_SOME(slave);
MockScheduler sched;
@@ -663,7 +662,7 @@ TEST_F(SlaveTest, DISABLED_ROOT_RunTaskWithCommandInfoWithUser)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -724,12 +723,12 @@ TEST_F(SlaveTest, DISABLED_ROOT_RunTaskWithCommandInfoWithUser)
// non-leading master is ignored.
TEST_F(SlaveTest, IgnoreNonLeaderStatusUpdateAcknowledgement)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
- Try<PID<Slave> > slave = StartSlave(&exec);
+ Try<PID<Slave>> slave = StartSlave(&exec);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -739,7 +738,7 @@ TEST_F(SlaveTest, IgnoreNonLeaderStatusUpdateAcknowledgement)
EXPECT_CALL(sched, registered(&schedDriver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&schedDriver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -887,7 +886,7 @@ TEST_F(SlaveTest, MetricsInMetricsEndpoint)
TEST_F(SlaveTest, StateEndpoint)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
slave::Flags flags = this->CreateSlaveFlags();
@@ -899,7 +898,7 @@ TEST_F(SlaveTest, StateEndpoint)
// Capture the start time deterministically.
Clock::pause();
- Try<PID<Slave> > slave = StartSlave(flags);
+ Try<PID<Slave>> slave = StartSlave(flags);
ASSERT_SOME(slave);
Future<http::Response> response = http::get(slave.get(), "state.json");
@@ -981,7 +980,7 @@ TEST_F(SlaveTest, StateEndpoint)
TEST_F(SlaveTest, TerminatingSlaveDoesNotReregister)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
// Create a MockExecutor to enable us to catch
@@ -1000,7 +999,7 @@ TEST_F(SlaveTest, TerminatingSlaveDoesNotReregister)
flags.executor_shutdown_grace_period = slave::REGISTER_RETRY_INTERVAL_MAX * 2;
// Start a slave.
- Try<PID<Slave> > slave = StartSlave(&exec, &detector, flags);
+ Try<PID<Slave>> slave = StartSlave(&exec, &detector, flags);
ASSERT_SOME(slave);
// Create a task on the slave.
@@ -1081,7 +1080,7 @@ TEST_F(SlaveTest, TerminatingSlaveDoesNotReregister)
TEST_F(SlaveTest, TerminalTaskContainerizerUpdateFails)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1090,7 +1089,7 @@ TEST_F(SlaveTest, TerminalTaskContainerizerUpdateFails)
TestContainerizer containerizer(&exec);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1099,7 +1098,7 @@ TEST_F(SlaveTest, TerminalTaskContainerizerUpdateFails)
EXPECT_CALL(sched, registered(_, _, _));
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
@@ -1178,7 +1177,7 @@ TEST_F(SlaveTest, TerminalTaskContainerizerUpdateFails)
TEST_F(SlaveTest, ContainerUpdatedBeforeTaskReachesExecutor)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1187,7 +1186,7 @@ TEST_F(SlaveTest, ContainerUpdatedBeforeTaskReachesExecutor)
TestContainerizer containerizer(&exec);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1235,7 +1234,7 @@ TEST_F(SlaveTest, ContainerUpdatedBeforeTaskReachesExecutor)
TEST_F(SlaveTest, TaskLaunchContainerizerUpdateFails)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1243,7 +1242,7 @@ TEST_F(SlaveTest, TaskLaunchContainerizerUpdateFails)
TestContainerizer containerizer(&exec);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave(&containerizer);
+ Try<PID<Slave>> slave = StartSlave(&containerizer);
ASSERT_SOME(slave);
MockScheduler sched;
@@ -1289,7 +1288,7 @@ TEST_F(SlaveTest, TaskLaunchContainerizerUpdateFails)
TEST_F(SlaveTest, PingTimeoutNoPings)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
// Block all pings to the slave.
@@ -1299,7 +1298,7 @@ TEST_F(SlaveTest, PingTimeoutNoPings)
FUTURE_PROTOBUF(SlaveRegisteredMessage(), _, _);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1328,14 +1327,14 @@ TEST_F(SlaveTest, PingTimeoutNoPings)
TEST_F(SlaveTest, PingTimeoutSomePings)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
Future<SlaveRegisteredMessage> slaveRegisteredMessage =
FUTURE_PROTOBUF(SlaveRegisteredMessage(), _, _);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1373,7 +1372,7 @@ TEST_F(SlaveTest, RateLimitSlaveShutdown)
{
// Start a master.
shared_ptr<MockRateLimiter> slaveRemovalLimiter(new MockRateLimiter());
- Try<PID<Master> > master = StartMaster(slaveRemovalLimiter);
+ Try<PID<Master>> master = StartMaster(slaveRemovalLimiter);
ASSERT_SOME(master);
// Set these expectations up before we spawn the slave so that we
@@ -1387,7 +1386,7 @@ TEST_F(SlaveTest, RateLimitSlaveShutdown)
FUTURE_PROTOBUF(SlaveRegisteredMessage(), _, _);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1436,7 +1435,7 @@ TEST_F(SlaveTest, CancelSlaveShutdown)
{
// Start a master.
shared_ptr<MockRateLimiter> slaveRemovalLimiter(new MockRateLimiter());
- Try<PID<Master> > master = StartMaster(slaveRemovalLimiter);
+ Try<PID<Master>> master = StartMaster(slaveRemovalLimiter);
ASSERT_SOME(master);
// Set these expectations up before we spawn the slave so that we
@@ -1453,7 +1452,7 @@ TEST_F(SlaveTest, CancelSlaveShutdown)
FUTURE_PROTOBUF(SlaveRegisteredMessage(), _, _);
// Start a slave.
- Try<PID<Slave> > slave = StartSlave();
+ Try<PID<Slave>> slave = StartSlave();
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
@@ -1511,7 +1510,7 @@ TEST_F(SlaveTest, CancelSlaveShutdown)
// called. See MESOS-1945.
TEST_F(SlaveTest, KillTaskBetweenRunTaskParts)
{
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1530,7 +1529,7 @@ TEST_F(SlaveTest, KillTaskBetweenRunTaskParts)
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
- Future<vector<Offer> > offers;
+ Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // Ignore subsequent offers.
@@ -1622,7 +1621,7 @@ TEST_F(SlaveTest, KillTaskBetweenRunTaskParts)
TEST_F(SlaveTest, ReregisterWithStatusUpdateTaskState)
{
// Start a master.
- Try<PID<Master> > master = StartMaster();
+ Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1632,7 +1631,7 @@ TEST_F(SlaveTest, ReregisterWithStatusUpdateTaskState)
StandaloneMasterDetector detector(master.get());
// Start a slave.
- Try<PID<Slave> > slave = StartSlave(&exec, &detector);
+ Try<PID<Slave>> slave = StartSlave(&exec, &detector);
ASSERT_SOME(slave);
MockScheduler sched;
[03/10] mesos git commit: Removed pre-C++11 codepath in libprocess.
Posted by be...@apache.org.
Removed pre-C++11 codepath in libprocess.
Review: https://reviews.apache.org/r/33561
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5ab8ff81
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5ab8ff81
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5ab8ff81
Branch: refs/heads/master
Commit: 5ab8ff815a8481a24ce46ae6e98f845236f8e627
Parents: d19a9d5
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:22:39 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:22:42 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/include/Makefile.am | 8 -
.../libprocess/include/process/c++11/defer.hpp | 262 -----------
.../include/process/c++11/deferred.hpp | 270 ------------
.../libprocess/include/process/c++11/delay.hpp | 88 ----
.../include/process/c++11/dispatch.hpp | 389 -----------------
.../include/process/c++11/executor.hpp | 68 ---
3rdparty/libprocess/include/process/collect.hpp | 83 ----
3rdparty/libprocess/include/process/defer.hpp | 435 ++++---------------
.../libprocess/include/process/deferred.hpp | 298 +++++++++----
3rdparty/libprocess/include/process/delay.hpp | 46 +-
.../libprocess/include/process/dispatch.hpp | 337 ++++++--------
.../libprocess/include/process/executor.hpp | 222 +---------
3rdparty/libprocess/include/process/future.hpp | 260 -----------
.../libprocess/include/process/timeseries.hpp | 10 -
3rdparty/libprocess/src/io.cpp | 156 -------
3rdparty/libprocess/src/tests/process_tests.cpp | 16 -
16 files changed, 440 insertions(+), 2508 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/Makefile.am b/3rdparty/libprocess/include/Makefile.am
index 3da3e6c..8aab059 100644
--- a/3rdparty/libprocess/include/Makefile.am
+++ b/3rdparty/libprocess/include/Makefile.am
@@ -52,11 +52,3 @@ nobase_include_HEADERS = \
process/timeout.hpp \
process/timer.hpp \
process/timeseries.hpp
-
-# C++11 Headers.
-nobase_include_HEADERS += \
- process/c++11/defer.hpp \
- process/c++11/deferred.hpp \
- process/c++11/delay.hpp \
- process/c++11/dispatch.hpp \
- process/c++11/executor.hpp
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/c++11/defer.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/c++11/defer.hpp b/3rdparty/libprocess/include/process/c++11/defer.hpp
deleted file mode 100644
index 7b4dd07..0000000
--- a/3rdparty/libprocess/include/process/c++11/defer.hpp
+++ /dev/null
@@ -1,262 +0,0 @@
-#ifndef __PROCESS_DEFER_HPP__
-#define __PROCESS_DEFER_HPP__
-
-#include <functional>
-#include <memory>
-
-#include <process/deferred.hpp>
-#include <process/dispatch.hpp>
-#include <process/executor.hpp>
-
-#include <stout/preprocessor.hpp>
-
-namespace process {
-
-// The defer mechanism is very similar to the dispatch mechanism (see
-// dispatch.hpp), however, rather than scheduling the method to get
-// invoked, the defer mechanism returns a 'Deferred' object that when
-// invoked does the underlying dispatch.
-
-// First, definitions of defer for methods returning void:
-
-template <typename T>
-Deferred<void(void)> defer(
- const PID<T>& pid,
- void (T::*method)(void))
-{
- return Deferred<void(void)>([=] () {
- dispatch(pid, method);
- });
-}
-
-
-template <typename T>
-Deferred<void(void)> defer(
- const Process<T>& process,
- void (T::*method)(void))
-{
- return defer(process.self(), method);
-}
-
-
-template <typename T>
-Deferred<void(void)> defer(
- const Process<T>* process,
- void (T::*method)(void))
-{
- return defer(process->self(), method);
-}
-
-
-// Due to a bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933)
-// with variadic templates and lambdas, we still need to do
-// preprocessor expansions. In addition, due to a bug with clang (or
-// libc++) we can't use std::bind with a std::function so we have to
-// explicitely use the std::function<R(P...)>::operator() (see
-// http://stackoverflow.com/questions/20097616/stdbind-to-a-stdfunction-crashes-with-clang).
-#define TEMPLATE(Z, N, DATA) \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto defer(const PID<T>& pid, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> _Deferred<decltype(std::bind(&std::function<void(ENUM_PARAMS(N, P))>::operator(), std::function<void(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))> /* NOLINT(whitespace/line_length) */ \
- { \
- std::function<void(ENUM_PARAMS(N, P))> f( \
- [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
- dispatch(pid, method, ENUM_PARAMS(N, p)); \
- }); \
- return std::bind(&std::function<void(ENUM_PARAMS(N, P))>::operator(), std::move(f), ENUM_PARAMS(N, a)); /* NOLINT(whitespace/line_length) */ \
- } \
- \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto defer(const Process<T>& process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> decltype(defer(process.self(), method, ENUM_PARAMS(N, a))) \
- { \
- return defer(process.self(), method, ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto defer(const Process<T>* process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> decltype(defer(process->self(), method, ENUM_PARAMS(N, a))) \
- { \
- return defer(process->self(), method, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-
-// Next, definitions of defer for methods returning future:
-
-template <typename R, typename T>
-Deferred<Future<R>(void)>
-defer(const PID<T>& pid, Future<R> (T::*method)(void))
-{
- return Deferred<Future<R>(void)>([=] () {
- return dispatch(pid, method);
- });
-}
-
-template <typename R, typename T>
-Deferred<Future<R>(void)>
-defer(const Process<T>& process, Future<R> (T::*method)(void))
-{
- return defer(process.self(), method);
-}
-
-template <typename R, typename T>
-Deferred<Future<R>(void)>
-defer(const Process<T>* process, Future<R> (T::*method)(void))
-{
- return defer(process->self(), method);
-}
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto defer(const PID<T>& pid, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))> /* NOLINT(whitespace/line_length) */ \
- { \
- std::function<Future<R>(ENUM_PARAMS(N, P))> f( \
- [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
- return dispatch(pid, method, ENUM_PARAMS(N, p)); \
- }); \
- return std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::move(f), ENUM_PARAMS(N, a)); /* NOLINT(whitespace/line_length) */ \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto defer(const Process<T>& process, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> decltype(defer(process.self(), method, ENUM_PARAMS(N, a))) \
- { \
- return defer(process.self(), method, ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto defer(const Process<T>* process, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> decltype(defer(process->self(), method, ENUM_PARAMS(N, a))) \
- { \
- return defer(process->self(), method, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-
-// Finaly, definitions of defer for methods returning a value:
-
-template <typename R, typename T>
-Deferred<Future<R>(void)>
-defer(const PID<T>& pid, R (T::*method)(void))
-{
- return Deferred<Future<R>(void)>([=] () {
- return dispatch(pid, method);
- });
-}
-
-template <typename R, typename T>
-Deferred<Future<R>(void)>
-defer(const Process<T>& process, R (T::*method)(void))
-{
- return defer(process.self(), method);
-}
-
-template <typename R, typename T>
-Deferred<Future<R>(void)>
-defer(const Process<T>* process, R (T::*method)(void))
-{
- return defer(process->self(), method);
-}
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto defer(const PID<T>& pid, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))> /* NOLINT(whitespace/line_length) */ \
- { \
- std::function<Future<R>(ENUM_PARAMS(N, P))> f( \
- [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
- return dispatch(pid, method, ENUM_PARAMS(N, p)); \
- }); \
- return std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::move(f), ENUM_PARAMS(N, a)); /* NOLINT(whitespace/line_length) */ \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto \
- defer(const Process<T>& process, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> decltype(defer(process.self(), method, ENUM_PARAMS(N, a))) \
- { \
- return defer(process.self(), method, ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- auto \
- defer(const Process<T>* process, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> decltype(defer(process->self(), method, ENUM_PARAMS(N, a))) \
- { \
- return defer(process->self(), method, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-
-// Now we define defer calls for functors (with and without a PID):
-
-template <typename F>
-_Deferred<F> defer(const UPID& pid, F&& f)
-{
- return _Deferred<F>(pid, std::forward<F>(f));
-}
-
-
-template <typename F>
-_Deferred<F> defer(F&& f)
-{
- if (__process__ != NULL) {
- return defer(__process__->self(), std::forward<F>(f));
- }
-
- return __executor__->defer(std::forward<F>(f));
-}
-
-} // namespace process {
-
-#endif // __PROCESS_DEFER_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/c++11/deferred.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/c++11/deferred.hpp b/3rdparty/libprocess/include/process/c++11/deferred.hpp
deleted file mode 100644
index 352205b..0000000
--- a/3rdparty/libprocess/include/process/c++11/deferred.hpp
+++ /dev/null
@@ -1,270 +0,0 @@
-#ifndef __PROCESS_DEFERRED_HPP__
-#define __PROCESS_DEFERRED_HPP__
-
-#include <functional>
-
-#include <process/dispatch.hpp>
-#include <process/pid.hpp>
-
-#include <stout/preprocessor.hpp>
-
-namespace process {
-
-// Acts like a function call but runs within an asynchronous execution
-// context such as an Executor or a ProcessBase (enforced because only
-// an executor or the 'defer' routines are allowed to create them).
-template <typename F>
-struct Deferred : std::function<F>
-{
-private:
- friend class Executor;
-
- template <typename G> friend struct _Deferred;
-
- // TODO(benh): Consider removing these in favor of having these
- // functions return _Deferred.
- template <typename T>
- friend Deferred<void(void)>
- defer(const PID<T>& pid, void (T::*method)(void));
-
- template <typename R, typename T>
- friend Deferred<Future<R>(void)>
- defer(const PID<T>& pid, Future<R> (T::*method)(void));
-
- template <typename R, typename T>
- friend Deferred<Future<R>(void)>
- defer(const PID<T>& pid, R (T::*method)(void));
-
- /*implicit*/ Deferred(const std::function<F>& f) : std::function<F>(f) {}
-};
-
-
-// We need an intermeidate "deferred" type because when constructing a
-// Deferred we won't always know the underlying function type (for
-// example, if we're being passed a std::bind or a lambda). A lambda
-// won't always implicitly convert to a std::function so instead we
-// hold onto the functor type F and let the compiler invoke the
-// necessary cast operator (below) when it actually has determined
-// what type is needed. This is similar in nature to how std::bind
-// works with it's intermediate _Bind type (which the pre-C++11
-// implementation relied on).
-template <typename F>
-struct _Deferred
-{
- operator Deferred<void()> () const
- {
- // The 'pid' differentiates an already dispatched functor versus
- // one which still needs to be dispatched (which is done
- // below). We have to delay wrapping the dispatch (for example, in
- // defer.hpp) as long as possible because we don't always know
- // what type the functor is or is going to be cast to (i.e., a
- // std::bind might can be cast to functions that do or do not take
- // arguments which will just be dropped when invoking the
- // underlying bound function).
- if (pid.isNone()) {
- return std::function<void()>(f);
- }
-
- // We need to explicitly copy the members otherwise we'll
- // implicitly copy 'this' which might not exist at invocation.
- Option<UPID> pid_ = pid;
- F f_ = f;
-
- return std::function<void()>(
- [=] () {
- dispatch(pid_.get(), std::function<void()>(f_));
- });
- }
-
- operator std::function<void()> () const
- {
- if (pid.isNone()) {
- return std::function<void()>(f);
- }
-
- Option<UPID> pid_ = pid;
- F f_ = f;
-
- return std::function<void()>(
- [=] () {
- dispatch(pid_.get(), std::function<void()>(f_));
- });
- }
-
- template <typename R>
- operator Deferred<R()> () const
- {
- if (pid.isNone()) {
- return std::function<R()>(f);
- }
-
- Option<UPID> pid_ = pid;
- F f_ = f;
-
- return std::function<R()>(
- [=] () {
- return dispatch(pid_.get(), std::function<R()>(f_));
- });
- }
-
- template <typename R>
- operator std::function<R()> () const
- {
- if (pid.isNone()) {
- return std::function<R()>(f);
- }
-
- Option<UPID> pid_ = pid;
- F f_ = f;
-
- return std::function<R()>(
- [=] () {
- return dispatch(pid_.get(), std::function<R()>(f_));
- });
- }
-
- // Due to a bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933)
- // with variadic templates and lambdas, we still need to do
- // preprocessor expansions. In addition, due to a bug with clang (or
- // libc++) we can't use std::bind with a std::function so we have to
- // explicitely use the std::function<R(P...)>::operator() (see
- // http://stackoverflow.com/questions/20097616/stdbind-to-a-stdfunction-crashes-with-clang).
-#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename P)> \
- operator Deferred<void(ENUM_PARAMS(N, P))> () const \
- { \
- if (pid.isNone()) { \
- return std::function<void(ENUM_PARAMS(N, P))>(f); \
- } \
- \
- Option<UPID> pid_ = pid; \
- F f_ = f; \
- \
- return std::function<void(ENUM_PARAMS(N, P))>( \
- [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
- std::function<void()> f__([=] () { \
- f_(ENUM_PARAMS(N, p)); \
- }); \
- dispatch(pid_.get(), f__); \
- }); \
- } \
- \
- template <ENUM_PARAMS(N, typename P)> \
- operator std::function<void(ENUM_PARAMS(N, P))> () const \
- { \
- if (pid.isNone()) { \
- return std::function<void(ENUM_PARAMS(N, P))>(f); \
- } \
- \
- Option<UPID> pid_ = pid; \
- F f_ = f; \
- \
- return std::function<void(ENUM_PARAMS(N, P))>( \
- [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
- std::function<void()> f__([=] () { \
- f_(ENUM_PARAMS(N, p)); \
- }); \
- dispatch(pid_.get(), f__); \
- }); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename R, ENUM_PARAMS(N, typename P)> \
- operator Deferred<R(ENUM_PARAMS(N, P))> () const \
- { \
- if (pid.isNone()) { \
- return std::function<R(ENUM_PARAMS(N, P))>(f); \
- } \
- \
- Option<UPID> pid_ = pid; \
- F f_ = f; \
- \
- return std::function<R(ENUM_PARAMS(N, P))>( \
- [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
- std::function<R()> f__([=] () { \
- return f_(ENUM_PARAMS(N, p)); \
- }); \
- return dispatch(pid_.get(), f__); \
- }); \
- } \
- \
- template <typename R, ENUM_PARAMS(N, typename P)> \
- operator std::function<R(ENUM_PARAMS(N, P))> () const \
- { \
- if (pid.isNone()) { \
- return std::function<R(ENUM_PARAMS(N, P))>(f); \
- } \
- \
- Option<UPID> pid_ = pid; \
- F f_ = f; \
- \
- return std::function<R(ENUM_PARAMS(N, P))>( \
- [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
- std::function<R()> f__([=] () { \
- return f_(ENUM_PARAMS(N, p)); \
- }); \
- return dispatch(pid_.get(), f__); \
- }); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-private:
- friend class Executor;
-
- template <typename G>
- friend _Deferred<G> defer(const UPID& pid, G&& g);
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- friend auto defer(const PID<T>& pid, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> _Deferred<decltype(std::bind(&std::function<void(ENUM_PARAMS(N, P))>::operator(), std::function<void(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))>; // NOLINT(whitespace/line_length)
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- friend auto defer(const PID<T>& pid, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))>; // NOLINT(whitespace/line_length)
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- friend auto defer(const PID<T>& pid, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))>; // NOLINT(whitespace/line_length)
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
- _Deferred(const UPID& pid, F f) : pid(pid), f(f) {}
-
- /*implicit*/ _Deferred(F f) : f(f) {}
-
- Option<UPID> pid;
- F f;
-};
-
-} // namespace process {
-
-#endif // __PROCESS_DEFERRED_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/c++11/delay.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/c++11/delay.hpp b/3rdparty/libprocess/include/process/c++11/delay.hpp
deleted file mode 100644
index 5818e83..0000000
--- a/3rdparty/libprocess/include/process/c++11/delay.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __PROCESS_DELAY_HPP__
-#define __PROCESS_DELAY_HPP__
-
-#include <process/clock.hpp>
-#include <process/dispatch.hpp>
-#include <process/timer.hpp>
-
-#include <stout/duration.hpp>
-#include <stout/preprocessor.hpp>
-
-namespace process {
-
-// The 'delay' mechanism enables you to delay a dispatch to a process
-// for some specified number of seconds. Returns a Timer instance that
-// can be cancelled (but it might have already executed or be
-// executing concurrently).
-
-template <typename T>
-Timer delay(const Duration& duration,
- const PID<T>& pid,
- void (T::*method)())
-{
- return Clock::timer(duration, [=] () {
- dispatch(pid, method);
- });
-}
-
-
-template <typename T>
-Timer delay(const Duration& duration,
- const Process<T>& process,
- void (T::*method)())
-{
- return delay(duration, process.self(), method);
-}
-
-
-template <typename T>
-Timer delay(const Duration& duration,
- const Process<T>* process,
- void (T::*method)())
-{
- return delay(duration, process->self(), method);
-}
-
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Timer delay(const Duration& duration, \
- const PID<T>& pid, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- return Clock::timer(duration, [=] () { \
- dispatch(pid, method, ENUM_PARAMS(N, a)); \
- }); \
- } \
- \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Timer delay(const Duration& duration, \
- const Process<T>& process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- return delay(duration, process.self(), method, ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Timer delay(const Duration& duration, \
- const Process<T>* process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- return delay(duration, process->self(), method, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-} // namespace process {
-
-#endif // __PROCESS_DELAY_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/c++11/dispatch.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/c++11/dispatch.hpp b/3rdparty/libprocess/include/process/c++11/dispatch.hpp
deleted file mode 100644
index 99de0e9..0000000
--- a/3rdparty/libprocess/include/process/c++11/dispatch.hpp
+++ /dev/null
@@ -1,389 +0,0 @@
-#ifndef __PROCESS_DISPATCH_HPP__
-#define __PROCESS_DISPATCH_HPP__
-
-#include <functional>
-#include <memory> // TODO(benh): Replace shared_ptr with unique_ptr.
-#include <string>
-
-#include <process/process.hpp>
-
-#include <stout/preprocessor.hpp>
-
-namespace process {
-
-// The dispatch mechanism enables you to "schedule" a method to get
-// invoked on a process. The result of that method invocation is
-// accessible via the future that is returned by the dispatch method
-// (note, however, that it might not be the _same_ future as the one
-// returned from the method, if the method even returns a future, see
-// below). Assuming some class 'Fibonacci' has a (visible) method
-// named 'compute' that takes an integer, N (and returns the Nth
-// fibonacci number) you might use dispatch like so:
-//
-// PID<Fibonacci> pid = spawn(new Fibonacci(), true); // Use the GC.
-// Future<int> f = dispatch(pid, &Fibonacci::compute, 10);
-//
-// Because the pid argument is "typed" we can ensure that methods are
-// only invoked on processes that are actually of that type. Providing
-// this mechanism for varying numbers of function types and arguments
-// requires support for variadic templates, slated to be released in
-// C++11. Until then, we use the Boost preprocessor macros to
-// accomplish the same thing (all be it less cleanly). See below for
-// those definitions.
-//
-// Dispatching is done via a level of indirection. The dispatch
-// routine itself creates a promise that is passed as an argument to a
-// partially applied 'dispatcher' function (defined below). The
-// dispatcher routines get passed to the actual process via an
-// internal routine called, not suprisingly, 'dispatch', defined
-// below:
-
-namespace internal {
-
-// The internal dispatch routine schedules a function to get invoked
-// within the context of the process associated with the specified pid
-// (first argument), unless that process is no longer valid. Note that
-// this routine does not expect anything in particular about the
-// specified function (second argument). The semantics are simple: the
-// function gets applied/invoked with the process as its first
-// argument. Currently we wrap the function in a shared_ptr but this
-// will probably change in the future to unique_ptr (or a variant).
-void dispatch(
- const UPID& pid,
- const std::shared_ptr<std::function<void(ProcessBase*)>>& f,
- const Option<const std::type_info*>& functionType = None());
-
-} // namespace internal {
-
-
-// Okay, now for the definition of the dispatch routines
-// themselves. For each routine we provide the version in C++11 using
-// variadic templates so the reader can see what the Boost
-// preprocessor macros are effectively providing. Using C++11 closures
-// would shorten these definitions even more.
-//
-// First, definitions of dispatch for methods returning void:
-
-template <typename T>
-void dispatch(
- const PID<T>& pid,
- void (T::*method)())
-{
- std::shared_ptr<std::function<void(ProcessBase*)>> f(
- new std::function<void(ProcessBase*)>(
- [=] (ProcessBase* process) {
- assert(process != NULL);
- T* t = dynamic_cast<T*>(process);
- assert(t != NULL);
- (t->*method)();
- }));
-
- internal::dispatch(pid, f, &typeid(method));
-}
-
-template <typename T>
-void dispatch(
- const Process<T>& process,
- void (T::*method)())
-{
- dispatch(process.self(), method);
-}
-
-template <typename T>
-void dispatch(
- const Process<T>* process,
- void (T::*method)())
-{
- dispatch(process->self(), method);
-}
-
-// Due to a bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933)
-// with variadic templates and lambdas, we still need to do
-// preprocessor expansions.
-#define TEMPLATE(Z, N, DATA) \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- void dispatch( \
- const PID<T>& pid, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- std::shared_ptr<std::function<void(ProcessBase*)>> f( \
- new std::function<void(ProcessBase*)>( \
- [=] (ProcessBase* process) { \
- assert(process != NULL); \
- T* t = dynamic_cast<T*>(process); \
- assert(t != NULL); \
- (t->*method)(ENUM_PARAMS(N, a)); \
- })); \
- \
- internal::dispatch(pid, f, &typeid(method)); \
- } \
- \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- void dispatch( \
- const Process<T>& process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- dispatch(process.self(), method, ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- void dispatch( \
- const Process<T>* process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- dispatch(process->self(), method, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-
-// Next, definitions of methods returning a future:
-
-template <typename R, typename T>
-Future<R> dispatch(
- const PID<T>& pid,
- Future<R> (T::*method)())
-{
- std::shared_ptr<Promise<R>> promise(new Promise<R>());
-
- std::shared_ptr<std::function<void(ProcessBase*)>> f(
- new std::function<void(ProcessBase*)>(
- [=] (ProcessBase* process) {
- assert(process != NULL);
- T* t = dynamic_cast<T*>(process);
- assert(t != NULL);
- promise->associate((t->*method)());
- }));
-
- internal::dispatch(pid, f, &typeid(method));
-
- return promise->future();
-}
-
-template <typename R, typename T>
-Future<R> dispatch(
- const Process<T>& process,
- Future<R> (T::*method)(void))
-{
- return dispatch(process.self(), method);
-}
-
-template <typename R, typename T>
-Future<R> dispatch(
- const Process<T>* process,
- Future<R> (T::*method)(void))
-{
- return dispatch(process->self(), method);
-}
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<R> dispatch( \
- const PID<T>& pid, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- std::shared_ptr<Promise<R>> promise(new Promise<R>()); \
- \
- std::shared_ptr<std::function<void(ProcessBase*)>> f( \
- new std::function<void(ProcessBase*)>( \
- [=] (ProcessBase* process) { \
- assert(process != NULL); \
- T* t = dynamic_cast<T*>(process); \
- assert(t != NULL); \
- promise->associate((t->*method)(ENUM_PARAMS(N, a))); \
- })); \
- \
- internal::dispatch(pid, f, &typeid(method)); \
- \
- return promise->future(); \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<R> dispatch( \
- const Process<T>& process, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- return dispatch(process.self(), method, ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<R> dispatch( \
- const Process<T>* process, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- return dispatch(process->self(), method, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-
-// Next, definitions of methods returning a value.
-
-template <typename R, typename T>
-Future<R> dispatch(
- const PID<T>& pid,
- R (T::*method)(void))
-{
- std::shared_ptr<Promise<R>> promise(new Promise<R>());
-
- std::shared_ptr<std::function<void(ProcessBase*)>> f(
- new std::function<void(ProcessBase*)>(
- [=] (ProcessBase* process) {
- assert(process != NULL);
- T* t = dynamic_cast<T*>(process);
- assert(t != NULL);
- promise->set((t->*method)());
- }));
-
- internal::dispatch(pid, f, &typeid(method));
-
- return promise->future();
-}
-
-template <typename R, typename T>
-Future<R> dispatch(
- const Process<T>& process,
- R (T::*method)())
-{
- return dispatch(process.self(), method);
-}
-
-template <typename R, typename T>
-Future<R> dispatch(
- const Process<T>* process,
- R (T::*method)())
-{
- return dispatch(process->self(), method);
-}
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<R> dispatch( \
- const PID<T>& pid, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- std::shared_ptr<Promise<R>> promise(new Promise<R>()); \
- \
- std::shared_ptr<std::function<void(ProcessBase*)>> f( \
- new std::function<void(ProcessBase*)>( \
- [=] (ProcessBase* process) { \
- assert(process != NULL); \
- T* t = dynamic_cast<T*>(process); \
- assert(t != NULL); \
- promise->set((t->*method)(ENUM_PARAMS(N, a))); \
- })); \
- \
- internal::dispatch(pid, f, &typeid(method)); \
- \
- return promise->future(); \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<R> dispatch( \
- const Process<T>& process, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- return dispatch(process.self(), method, ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename R, \
- typename T, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<R> dispatch( \
- const Process<T>* process, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- return dispatch(process->self(), method, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-
-inline void dispatch(
- const UPID& pid,
- const std::function<void()>& f)
-{
- std::shared_ptr<std::function<void(ProcessBase*)>> f_(
- new std::function<void(ProcessBase*)>(
- [=] (ProcessBase*) {
- f();
- }));
-
- internal::dispatch(pid, f_);
-}
-
-
-template <typename R>
-Future<R> dispatch(
- const UPID& pid,
- const std::function<Future<R>()>& f)
-{
- std::shared_ptr<Promise<R>> promise(new Promise<R>());
-
- std::shared_ptr<std::function<void(ProcessBase*)>> f_(
- new std::function<void(ProcessBase*)>(
- [=] (ProcessBase*) {
- promise->associate(f());
- }));
-
- internal::dispatch(pid, f_);
-
- return promise->future();
-}
-
-
-template <typename R>
-Future<R> dispatch(
- const UPID& pid,
- const std::function<R()>& f)
-{
- std::shared_ptr<Promise<R>> promise(new Promise<R>());
-
- std::shared_ptr<std::function<void(ProcessBase*)>> f_(
- new std::function<void(ProcessBase*)>(
- [=] (ProcessBase*) {
- promise->set(f());
- }));
-
- internal::dispatch(pid, f_);
-
- return promise->future();
-}
-
-} // namespace process {
-
-#endif // __PROCESS_DISPATCH_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/c++11/executor.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/c++11/executor.hpp b/3rdparty/libprocess/include/process/c++11/executor.hpp
deleted file mode 100644
index 157a1d2..0000000
--- a/3rdparty/libprocess/include/process/c++11/executor.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef __PROCESS_EXECUTOR_HPP__
-#define __PROCESS_EXECUTOR_HPP__
-
-#include <process/defer.hpp>
-#include <process/deferred.hpp>
-#include <process/id.hpp>
-#include <process/process.hpp>
-
-#include <stout/thread.hpp>
-
-namespace process {
-
-// Provides an abstraction that can take a standard function object
-// and defer it without needing a process. Each converted function
-// object will get execute serially with respect to one another when
-// invoked.
-class Executor
-{
-public:
- Executor() : process(ID::generate("__executor__"))
- {
- spawn(process);
- }
-
- ~Executor()
- {
- terminate(process);
- wait(process);
- }
-
- void stop()
- {
- terminate(&process);
-
- // TODO(benh): Note that this doesn't wait because that could
- // cause a deadlock ... thus, the semantics here are that no more
- // dispatches will occur after this function returns but one may
- // be occuring concurrently.
- }
-
- template <typename F>
- _Deferred<F> defer(F&& f)
- {
- return _Deferred<F>(process.self(), std::forward<F>(f));
- }
-
-
-private:
- // Not copyable, not assignable.
- Executor(const Executor&);
- Executor& operator = (const Executor&);
-
- ProcessBase process;
-};
-
-
-// Per thread executor pointer. The extra level of indirection from
-// _executor_ to __executor__ is used in order to take advantage of
-// the ThreadLocal operators without needing the extra dereference as
-// well as lazily construct the actual executor.
-extern ThreadLocal<Executor>* _executor_;
-
-#define __executor__ \
- (*_executor_ == NULL ? *_executor_ = new Executor() : *_executor_)
-
-} // namespace process {
-
-#endif // __PROCESS_EXECUTOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/collect.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/collect.hpp b/3rdparty/libprocess/include/process/collect.hpp
index 2e2fce6..ca220c3 100644
--- a/3rdparty/libprocess/include/process/collect.hpp
+++ b/3rdparty/libprocess/include/process/collect.hpp
@@ -162,36 +162,6 @@ private:
};
-#if __cplusplus < 201103L
-
-template <typename T>
-void _await(
- const Future<T>& result,
- Owned<Promise<Nothing>> promise)
-{
- promise->set(Nothing());
-}
-
-
-template <typename T1, typename T2>
-Future<tuples::tuple<Future<T1>, Future<T2>>> __await(
- const tuples::tuple<Future<T1>, Future<T2>>& future)
-{
- return future;
-}
-
-
-// NOTE: We do not use overload (i.e., '__await') here because gcc-4.4
-// cannot resolve the overload when we call 'bind' below.
-template <typename T1, typename T2, typename T3>
-Future<tuples::tuple<Future<T1>, Future<T2>, Future<T3>>> ___await(
- const tuples::tuple<Future<T1>, Future<T2>, Future<T3>>& future)
-{
- return future;
-}
-
-#endif // __cplusplus < 201103L
-
} // namespace internal {
@@ -226,8 +196,6 @@ inline Future<std::list<Future<T>>> await(
}
-#if __cplusplus >= 201103L
-
template <typename T1, typename T2>
Future<tuples::tuple<Future<T1>, Future<T2>>> await(
const Future<T1>& future1,
@@ -271,57 +239,6 @@ Future<tuples::tuple<Future<T1>, Future<T2>, Future<T3>>> await(
.then([=] () { return tuples::make_tuple(future1, future2, future3); });
}
-#else // __cplusplus >= 201103L
-
-template <typename T1, typename T2>
-Future<tuples::tuple<Future<T1>, Future<T2>>> await(
- const Future<T1>& future1,
- const Future<T2>& future2)
-{
- Owned<Promise<Nothing>> promise1(new Promise<Nothing>());
- Owned<Promise<Nothing>> promise2(new Promise<Nothing>());
-
- future1.onAny(lambda::bind(internal::_await<T1>, lambda::_1, promise1));
- future2.onAny(lambda::bind(internal::_await<T2>, lambda::_1, promise2));
-
- std::list<Future<Nothing>> futures;
- futures.push_back(promise1->future());
- futures.push_back(promise2->future());
-
- return await(futures)
- .then(lambda::bind(
- internal::__await<T1, T2>,
- tuples::make_tuple(future1, future2)));
-}
-
-
-template <typename T1, typename T2, typename T3>
-Future<tuples::tuple<Future<T1>, Future<T2>, Future<T3>>> await(
- const Future<T1>& future1,
- const Future<T2>& future2,
- const Future<T3>& future3)
-{
- Owned<Promise<Nothing>> promise1(new Promise<Nothing>());
- Owned<Promise<Nothing>> promise2(new Promise<Nothing>());
- Owned<Promise<Nothing>> promise3(new Promise<Nothing>());
-
- future1.onAny(lambda::bind(internal::_await<T1>, lambda::_1, promise1));
- future2.onAny(lambda::bind(internal::_await<T2>, lambda::_1, promise2));
- future3.onAny(lambda::bind(internal::_await<T3>, lambda::_1, promise3));
-
- std::list<Future<Nothing>> futures;
- futures.push_back(promise1->future());
- futures.push_back(promise2->future());
- futures.push_back(promise3->future());
-
- return await(futures)
- .then(lambda::bind(
- internal::___await<T1, T2, T3>,
- tuples::make_tuple(future1, future2, future3)));
-}
-
-#endif // __cplusplus >= 201103L
-
} // namespace process {
#endif // __PROCESS_COLLECT_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/defer.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/defer.hpp b/3rdparty/libprocess/include/process/defer.hpp
index ebe6f2d..7b4dd07 100644
--- a/3rdparty/libprocess/include/process/defer.hpp
+++ b/3rdparty/libprocess/include/process/defer.hpp
@@ -1,10 +1,8 @@
-#if __cplusplus >= 201103L
-#include <process/c++11/defer.hpp>
-#else
#ifndef __PROCESS_DEFER_HPP__
#define __PROCESS_DEFER_HPP__
-#include <tr1/functional>
+#include <functional>
+#include <memory>
#include <process/deferred.hpp>
#include <process/dispatch.hpp>
@@ -17,84 +15,68 @@ namespace process {
// The defer mechanism is very similar to the dispatch mechanism (see
// dispatch.hpp), however, rather than scheduling the method to get
// invoked, the defer mechanism returns a 'Deferred' object that when
-// invoked does the underlying dispatch. Similar to dispatch, we
-// provide the C++11 variadic template definitions first, and then use
-// Boost preprocessor macros to provide the actual definitions.
-
+// invoked does the underlying dispatch.
// First, definitions of defer for methods returning void:
-//
-// template <typename T, typename ...P>
-// Deferred<void(void)> void defer(const PID<T>& pid,
-// void (T::*method)(P...),
-// P... p)
-// {
-// void (*dispatch)(const PID<T>&, void (T::*)(P...), P...) =
-// &process::template dispatch<T, P...>;
-
-// return Deferred<void(void)>(
-// std::tr1::bind(dispatch, pid, method, std::forward<P>(p)...));
-// }
template <typename T>
-_Defer<void(*(PID<T>, void (T::*)(void)))
- (const PID<T>&, void (T::*)(void))>
-defer(const PID<T>& pid, void (T::*method)(void))
+Deferred<void(void)> defer(
+ const PID<T>& pid,
+ void (T::*method)(void))
{
- void (*dispatch)(const PID<T>&, void (T::*)(void)) =
- &process::template dispatch<T>;
- return std::tr1::bind(dispatch, pid, method);
+ return Deferred<void(void)>([=] () {
+ dispatch(pid, method);
+ });
}
+
template <typename T>
-_Defer<void(*(PID<T>, void (T::*)(void)))
- (const PID<T>&, void (T::*)(void))>
-defer(const Process<T>& process, void (T::*method)(void))
+Deferred<void(void)> defer(
+ const Process<T>& process,
+ void (T::*method)(void))
{
return defer(process.self(), method);
}
+
template <typename T>
-_Defer<void(*(PID<T>, void (T::*)(void)))
- (const PID<T>&, void (T::*)(void))>
-defer(const Process<T>* process, void (T::*method)(void))
+Deferred<void(void)> defer(
+ const Process<T>* process,
+ void (T::*method)(void))
{
return defer(process->self(), method);
}
+
+// Due to a bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933)
+// with variadic templates and lambdas, we still need to do
+// preprocessor expansions. In addition, due to a bug with clang (or
+// libc++) we can't use std::bind with a std::function so we have to
+// explicitely use the std::function<R(P...)>::operator() (see
+// http://stackoverflow.com/questions/20097616/stdbind-to-a-stdfunction-crashes-with-clang).
#define TEMPLATE(Z, N, DATA) \
template <typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<void(*(PID<T>, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const PID<T>& pid, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
+ auto defer(const PID<T>& pid, \
+ void (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> _Deferred<decltype(std::bind(&std::function<void(ENUM_PARAMS(N, P))>::operator(), std::function<void(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))> /* NOLINT(whitespace/line_length) */ \
{ \
- void (*dispatch)(const PID<T>&, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P)) = \
- &process::template dispatch<T, ENUM_PARAMS(N, P), ENUM_PARAMS(N, P)>; \
- return std::tr1::bind(dispatch, pid, method, ENUM_PARAMS(N, a)); \
+ std::function<void(ENUM_PARAMS(N, P))> f( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ dispatch(pid, method, ENUM_PARAMS(N, p)); \
+ }); \
+ return std::bind(&std::function<void(ENUM_PARAMS(N, P))>::operator(), std::move(f), ENUM_PARAMS(N, a)); /* NOLINT(whitespace/line_length) */ \
} \
\
template <typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<void(*(PID<T>, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const Process<T>& process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
+ auto defer(const Process<T>& process, \
+ void (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> decltype(defer(process.self(), method, ENUM_PARAMS(N, a))) \
{ \
return defer(process.self(), method, ENUM_PARAMS(N, a)); \
} \
@@ -102,15 +84,10 @@ defer(const Process<T>* process, void (T::*method)(void))
template <typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<void(*(PID<T>, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const Process<T>* process, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
+ auto defer(const Process<T>* process, \
+ void (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> decltype(defer(process->self(), method, ENUM_PARAMS(N, a))) \
{ \
return defer(process->self(), method, ENUM_PARAMS(N, a)); \
}
@@ -120,40 +97,25 @@ defer(const Process<T>* process, void (T::*method)(void))
// Next, definitions of defer for methods returning future:
-//
-// template <typename R, typename T, typename ...P>
-// Deferred<Future<R>(void)> void defer(const PID<T>& pid,
-// Future<R> (T::*method)(P...),
-// P... p)
-// {
-// Future<R> (*dispatch)(const PID<T>&, Future<R> (T::*)(P...), P...) =
-// &process::template dispatch<R, T, P...>;
-//
-// return Deferred<Future<R>(void)>(
-// std::tr1::bind(dispatch, pid, method, std::forward<P>(p)...));
-// }
template <typename R, typename T>
-_Defer<Future<R>(*(PID<T>, Future<R> (T::*)(void)))
- (const PID<T>&, Future<R> (T::*)(void))>
+Deferred<Future<R>(void)>
defer(const PID<T>& pid, Future<R> (T::*method)(void))
{
- Future<R> (*dispatch)(const PID<T>&, Future<R> (T::*)(void)) =
- &process::template dispatch<R, T>;
- return std::tr1::bind(dispatch, pid, method);
+ return Deferred<Future<R>(void)>([=] () {
+ return dispatch(pid, method);
+ });
}
template <typename R, typename T>
-_Defer<Future<R>(*(PID<T>, Future<R> (T::*)(void)))(
- const PID<T>&, Future<R> (T::*)(void))>
+Deferred<Future<R>(void)>
defer(const Process<T>& process, Future<R> (T::*method)(void))
{
return defer(process.self(), method);
}
template <typename R, typename T>
-_Defer<Future<R>(*(PID<T>, Future<R> (T::*)(void)))
- (const PID<T>&, Future<R> (T::*)(void))>
+Deferred<Future<R>(void)>
defer(const Process<T>* process, Future<R> (T::*method)(void))
{
return defer(process->self(), method);
@@ -164,36 +126,26 @@ defer(const Process<T>* process, Future<R> (T::*method)(void))
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<Future<R>(*(PID<T>, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const PID<T>& pid, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
+ auto defer(const PID<T>& pid, \
+ Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))> /* NOLINT(whitespace/line_length) */ \
{ \
- Future<R> (*dispatch)(const PID<T>&, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P)) = \
- &process::template dispatch<R, T, ENUM_PARAMS(N, P), ENUM_PARAMS(N, P)>; \
- return std::tr1::bind(dispatch, pid, method, ENUM_PARAMS(N, a)); \
+ std::function<Future<R>(ENUM_PARAMS(N, P))> f( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ return dispatch(pid, method, ENUM_PARAMS(N, p)); \
+ }); \
+ return std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::move(f), ENUM_PARAMS(N, a)); /* NOLINT(whitespace/line_length) */ \
} \
\
template <typename R, \
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<Future<R>(*(PID<T>, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const Process<T>& process, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
+ auto defer(const Process<T>& process, \
+ Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> decltype(defer(process.self(), method, ENUM_PARAMS(N, a))) \
{ \
return defer(process.self(), method, ENUM_PARAMS(N, a)); \
} \
@@ -202,15 +154,10 @@ defer(const Process<T>* process, Future<R> (T::*method)(void))
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<Future<R>(*(PID<T>, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const Process<T>* process, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
+ auto defer(const Process<T>* process, \
+ Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> decltype(defer(process->self(), method, ENUM_PARAMS(N, a))) \
{ \
return defer(process->self(), method, ENUM_PARAMS(N, a)); \
}
@@ -219,41 +166,26 @@ defer(const Process<T>* process, Future<R> (T::*method)(void))
#undef TEMPLATE
-// Next, definitions of defer for methods returning a value:
-//
-// template <typename R, typename T, typename ...P>
-// Deferred<Future<R>(void)> void defer(const PID<T>& pid,
-// R (T::*method)(P...),
-// P... p)
-// {
-// Future<R> (*dispatch)(const PID<T>&, R (T::*)(P...), P...) =
-// &process::template dispatch<R, T, P...>;
-//
-// return Deferred<Future<R>(void)>(
-// std::tr1::bind(dispatch, pid, method, std::forward<P>(p)...));
-// }
+// Finaly, definitions of defer for methods returning a value:
template <typename R, typename T>
-_Defer<Future<R>(*(PID<T>, R (T::*)(void)))
- (const PID<T>&, R (T::*)(void))>
+Deferred<Future<R>(void)>
defer(const PID<T>& pid, R (T::*method)(void))
{
- Future<R> (*dispatch)(const PID<T>&, R (T::*)(void)) =
- &process::template dispatch<R, T>;
- return std::tr1::bind(dispatch, pid, method);
+ return Deferred<Future<R>(void)>([=] () {
+ return dispatch(pid, method);
+ });
}
template <typename R, typename T>
-_Defer<Future<R>(*(PID<T>, R (T::*)(void)))
- (const PID<T>&, R (T::*)(void))>
+Deferred<Future<R>(void)>
defer(const Process<T>& process, R (T::*method)(void))
{
return defer(process.self(), method);
}
template <typename R, typename T>
-_Defer<Future<R>(*(PID<T>, R (T::*)(void)))
- (const PID<T>&, R (T::*)(void))>
+Deferred<Future<R>(void)>
defer(const Process<T>* process, R (T::*method)(void))
{
return defer(process->self(), method);
@@ -264,36 +196,27 @@ defer(const Process<T>* process, R (T::*method)(void))
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<Future<R>(*(PID<T>, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const PID<T>& pid, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a)) \
+ auto defer(const PID<T>& pid, \
+ R (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))> /* NOLINT(whitespace/line_length) */ \
{ \
- Future<R> (*dispatch)(const PID<T>&, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P)) = \
- &process::template dispatch<R, T, ENUM_PARAMS(N, P), ENUM_PARAMS(N, P)>; \
- return std::tr1::bind(dispatch, pid, method, ENUM_PARAMS(N, a)); \
+ std::function<Future<R>(ENUM_PARAMS(N, P))> f( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ return dispatch(pid, method, ENUM_PARAMS(N, p)); \
+ }); \
+ return std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::move(f), ENUM_PARAMS(N, a)); /* NOLINT(whitespace/line_length) */ \
} \
\
template <typename R, \
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<Future<R>(*(PID<T>, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
+ auto \
defer(const Process<T>& process, \
R (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
+ -> decltype(defer(process.self(), method, ENUM_PARAMS(N, a))) \
{ \
return defer(process.self(), method, ENUM_PARAMS(N, a)); \
} \
@@ -302,15 +225,11 @@ defer(const Process<T>* process, R (T::*method)(void))
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- _Defer<Future<R>(*(PID<T>, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
+ auto \
defer(const Process<T>* process, \
R (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
+ -> decltype(defer(process->self(), method, ENUM_PARAMS(N, a))) \
{ \
return defer(process->self(), method, ENUM_PARAMS(N, a)); \
}
@@ -319,195 +238,25 @@ defer(const Process<T>* process, R (T::*method)(void))
#undef TEMPLATE
-namespace internal {
-
-inline void invoker(
- ProcessBase* _,
- const std::tr1::function<void(void)>& f)
-{
- f();
-}
-
-inline void dispatcher(
- const UPID& pid,
- const std::tr1::function<void(void)>& f)
-{
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > invoker(
- new std::tr1::function<void(ProcessBase*)>(
- std::tr1::bind(&internal::invoker,
- std::tr1::placeholders::_1,
- f)));
-
- internal::dispatch(pid, invoker);
-}
-
-#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename A)> \
- void CAT(vinvoker, N)( \
- ProcessBase* _, \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f, \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- f(ENUM_PARAMS(N, a)); \
- } \
- \
- template <typename R, ENUM_PARAMS(N, typename A)> \
- void CAT(invoker, N)( \
- ProcessBase* _, \
- const std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>& f, \
- const std::tr1::shared_ptr<Promise<R> >& promise, \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- if (promise->future().hasDiscard()) { \
- promise->discard(); \
- } else { \
- promise->set(f(ENUM_PARAMS(N, a))); \
- } \
- } \
- \
- template <ENUM_PARAMS(N, typename A)> \
- void CAT(vdispatcher, N)( \
- const UPID& pid, \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f, \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > invoker( \
- new std::tr1::function<void(ProcessBase*)>( \
- std::tr1::bind(&internal::CAT(vinvoker, N)<ENUM_PARAMS(N, A)>, \
- std::tr1::placeholders::_1, \
- f, \
- ENUM_PARAMS(N, a)))); \
- \
- internal::dispatch(pid, invoker); \
- } \
- \
- template <typename R, ENUM_PARAMS(N, typename A)> \
- Future<R> CAT(dispatcher, N)( \
- const UPID& pid, \
- const std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>& f, \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- std::tr1::shared_ptr<Promise<R> > promise(new Promise<R>()); \
- \
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > invoker( \
- new std::tr1::function<void(ProcessBase*)>( \
- std::tr1::bind(&internal::CAT(invoker, N)<R, ENUM_PARAMS(N, A)>, \
- std::tr1::placeholders::_1, \
- f, \
- promise, \
- ENUM_PARAMS(N, a)))); \
- \
- internal::dispatch(pid, invoker); \
- \
- return promise->future(); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
-
- // We can't easily use 'std::tr1::_Placeholder<X>' when doing macro
- // expansion via ENUM_BINARY_PARAMS because compilers don't like it
- // when you try and concatenate '<' 'N' '>'. Thus, we typedef them.
-#define TEMPLATE(Z, N, DATA) \
- typedef std::tr1::_Placeholder<INC(N)> _ ## N;
-
- REPEAT(10, TEMPLATE, _)
-#undef TEMPLATE
-
-} // namespace internal {
-
+// Now we define defer calls for functors (with and without a PID):
-// Now we define defer calls for functions and bind statements.
-inline Deferred<void(void)> defer(
- const UPID& pid,
- const std::tr1::function<void(void)>& f)
+template <typename F>
+_Deferred<F> defer(const UPID& pid, F&& f)
{
- return std::tr1::function<void(void)>(
- std::tr1::bind(&internal::dispatcher,
- pid,
- f));
+ return _Deferred<F>(pid, std::forward<F>(f));
}
-// Now we define defer calls for functions and bind statements.
-inline Deferred<void(void)> defer(const std::tr1::function<void(void)>& f)
+template <typename F>
+_Deferred<F> defer(F&& f)
{
if (__process__ != NULL) {
- // In C++11:
- // const UPID pid = __process__->self();
- // return []() {
- // internal::dispatch(pid, [](ProcessBase* _) { f(); });
- // }
- return std::tr1::function<void(void)>(
- std::tr1::bind(&internal::dispatcher,
- __process__->self(),
- f));
+ return defer(__process__->self(), std::forward<F>(f));
}
- return __executor__->defer(f);
+ return __executor__->defer(std::forward<F>(f));
}
-
-#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const UPID& pid, \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f) \
- { \
- return std::tr1::function<void(ENUM_PARAMS(N, A))>( \
- std::tr1::bind(&internal::CAT(vdispatcher, N)<ENUM_PARAMS(N, A)>, \
- pid, \
- f, \
- ENUM_BINARY_PARAMS(N, internal::_, () INTERCEPT))); \
- } \
- \
- template <ENUM_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f) \
- { \
- if (__process__ != NULL) { \
- return std::tr1::function<void(ENUM_PARAMS(N, A))>( \
- std::tr1::bind(&internal::CAT(vdispatcher, N)<ENUM_PARAMS(N, A)>, \
- __process__->self(), \
- f, \
- ENUM_BINARY_PARAMS(N, internal::_, () INTERCEPT))); \
- } \
- \
- return __executor__->defer(f); \
- } \
- \
- template <typename R, ENUM_PARAMS(N, typename A)> \
- Deferred<Future<R>(ENUM_PARAMS(N, A))> defer( \
- const UPID& pid, \
- const std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>& f) \
- { \
- return std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>( \
- std::tr1::bind(&internal::CAT(dispatcher, N)<R, ENUM_PARAMS(N, A)>, \
- pid, \
- f, \
- ENUM_BINARY_PARAMS(N, internal::_, () INTERCEPT))); \
- } \
- \
- template <typename R, ENUM_PARAMS(N, typename A)> \
- Deferred<Future<R>(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>& f) \
- { \
- if (__process__ != NULL) { \
- return std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>( \
- std::tr1::bind(&internal::CAT(dispatcher, N)<R, ENUM_PARAMS(N, A)>, \
- __process__->self(), \
- f, \
- ENUM_BINARY_PARAMS(N, internal::_, () INTERCEPT))); \
- } \
- \
- return __executor__->defer(f); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
} // namespace process {
#endif // __PROCESS_DEFER_HPP__
-#endif // __cplusplus >= 201103L
[04/10] mesos git commit: Removed pre-C++11 codepath in Mesos.
Posted by be...@apache.org.
Removed pre-C++11 codepath in Mesos.
Review: https://reviews.apache.org/r/33562
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/48c72969
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/48c72969
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/48c72969
Branch: refs/heads/master
Commit: 48c729699dc86f2e34f90b8f9cf2e7adf69d4220
Parents: 5ab8ff8
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:23:08 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:23:08 2015 -0700
----------------------------------------------------------------------
include/mesos/scheduler.hpp | 17 -----------------
1 file changed, 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/48c72969/include/mesos/scheduler.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/scheduler.hpp b/include/mesos/scheduler.hpp
index efee2cb..2ee6b5c 100644
--- a/include/mesos/scheduler.hpp
+++ b/include/mesos/scheduler.hpp
@@ -19,12 +19,7 @@
#ifndef __MESOS_SCHEDULER_HPP__
#define __MESOS_SCHEDULER_HPP__
-#if __cplusplus >= 201103L
#include <functional>
-#else // __cplusplus >= 201103L
-#include <tr1/functional>
-#endif // __cplusplus >= 201103L
-
#include <queue>
#include <pthread.h>
@@ -489,29 +484,17 @@ class Mesos
{
public:
Mesos(const std::string& master,
-#if __cplusplus >= 201103L
const std::function<void(void)>& connected,
const std::function<void(void)>& disconnected,
const std::function<void(const std::queue<Event>&)>& received);
-#else // __cplusplus >= 201103L
- const std::tr1::function<void(void)>& connected,
- const std::tr1::function<void(void)>& disconnected,
- const std::tr1::function<void(const std::queue<Event>&)>& received);
-#endif // __cplusplus >= 201103L
// Same as the above constructor but takes 'credential' as argument.
// The credential will be used for authenticating with the master.
Mesos(const std::string& master,
const Credential& credential,
-#if __cplusplus >= 201103L
const std::function<void(void)>& connected,
const std::function<void(void)>& disconnected,
const std::function<void(const std::queue<Event>&)>& received);
-#else // __cplusplus >= 201103L
- const std::tr1::function<void(void)>& connected,
- const std::tr1::function<void(void)>& disconnected,
- const std::tr1::function<void(const std::queue<Event>&)>& received);
-#endif // __cplusplus >= 201103L
virtual ~Mesos();
[05/10] mesos git commit: Removed from stout.
Posted by be...@apache.org.
Removed <stout/memory.hpp> from stout.
Requires switching from 'memory::' to 'std::'.
Review: https://reviews.apache.org/r/33564
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/20b16267
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/20b16267
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/20b16267
Branch: refs/heads/master
Commit: 20b16267df89dccd2acd19c8740dc0573821b0d9
Parents: 48c7296
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:23:36 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:23:37 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/README.md | 8 --------
3rdparty/libprocess/3rdparty/stout/include/Makefile.am | 1 -
3rdparty/libprocess/3rdparty/stout/include/stout/os/fork.hpp | 7 +++----
3 files changed, 3 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/20b16267/3rdparty/libprocess/3rdparty/stout/README.md
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/README.md b/3rdparty/libprocess/3rdparty/stout/README.md
index 587f015..588f739 100644
--- a/3rdparty/libprocess/3rdparty/stout/README.md
+++ b/3rdparty/libprocess/3rdparty/stout/README.md
@@ -22,7 +22,6 @@ Note that the library is designed to completely avoid exceptions. See [exception
* <a href="#gzip">gzip::</a>
* <a href="#json">JSON::</a>
* <a href="#lambda">lambda::</a>
-* <a href="#memory">memory::</a>
* <a href="#net">net::</a>
* <a href="#os">os::</a>
* <a href="#path">path::</a>
@@ -220,13 +219,6 @@ You can "render" a JSON value using `std::ostream operator <<` (or by using `str
To help deal with compatibility issues between C++98/03 and C++11 we wrap some of the TR1 types from `functional` in `lambda`. That way, when using `lambda::bind` you'll get `std::tr1::bind` where TR1 is available and `std::bind` when C++11 is available.
-<a href="memory"></a>
-
-## `memory::`
-
-Similiar to `lambda`, we provide a `memory` namespace to help deal with compatibility issues between C++98/03 and C++11 that wraps some of the TR1 types from `memory`.
-
-
<a href="net"></a>
## `net::`
http://git-wip-us.apache.org/repos/asf/mesos/blob/20b16267/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
index 8effd89..26ecb73 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
@@ -32,7 +32,6 @@ nobase_include_HEADERS = \
stout/linkedhashmap.hpp \
stout/list.hpp \
stout/mac.hpp \
- stout/memory.hpp \
stout/multihashmap.hpp \
stout/multimap.hpp \
stout/net.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/20b16267/3rdparty/libprocess/3rdparty/stout/include/stout/os/fork.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/fork.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/fork.hpp
index 3832d95..d72b4c1 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/fork.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/fork.hpp
@@ -22,6 +22,7 @@
#include <sys/wait.h>
#include <list>
+#include <memory>
#include <set>
#include <string>
@@ -29,7 +30,6 @@
#include <stout/error.hpp>
#include <stout/exit.hpp>
#include <stout/foreach.hpp>
-#include <stout/memory.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
#include <stout/stringify.hpp>
@@ -235,7 +235,7 @@ private:
bool set; // Has this been initialized?
};
- memory::shared_ptr<Memory> memory;
+ std::shared_ptr<Memory> memory;
std::vector<Tree> children;
};
@@ -311,8 +311,7 @@ private:
SharedMemoryDeleter deleter(fd);
Tree tree;
- tree.memory = memory::shared_ptr<Tree::Memory>(
- (Tree::Memory*) memory, deleter);
+ tree.memory = std::shared_ptr<Tree::Memory>((Tree::Memory*)memory, deleter);
tree.memory->set = false;
for (size_t i = 0; i < children.size(); i++) {
[10/10] mesos git commit: Switched from 'tuples::' to 'std::' in
Mesos.
Posted by be...@apache.org.
Switched from 'tuples::' to 'std::' in Mesos.
Review: https://reviews.apache.org/r/33569
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d3dfbd9b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d3dfbd9b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d3dfbd9b
Branch: refs/heads/master
Commit: d3dfbd9bcf41105abfab5306b309c2a772167323
Parents: 6b8d326
Author: Michael Park <mc...@gmail.com>
Authored: Sun Apr 26 12:26:34 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Apr 26 12:26:35 2015 -0700
----------------------------------------------------------------------
.../containerizer/external_containerizer.cpp | 10 ++++----
.../containerizer/external_containerizer.hpp | 8 +++---
.../containerizer/isolators/posix/disk.cpp | 10 ++++----
src/zookeeper/zookeeper.cpp | 26 +++++++++-----------
4 files changed, 26 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3dfbd9b/src/slave/containerizer/external_containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.cpp b/src/slave/containerizer/external_containerizer.cpp
index 9a72acb..33fc010 100644
--- a/src/slave/containerizer/external_containerizer.cpp
+++ b/src/slave/containerizer/external_containerizer.cpp
@@ -19,6 +19,7 @@
#include <iostream>
#include <iomanip>
#include <list>
+#include <tuple>
#include <errno.h>
#include <poll.h>
@@ -58,10 +59,9 @@ using std::map;
using std::set;
using std::string;
using std::stringstream;
+using std::tuple;
using std::vector;
-using tuples::tuple;
-
using namespace process;
namespace mesos {
@@ -113,12 +113,12 @@ static Try<T> result(
return Error("Could not receive any result");
}
- Option<Error> error = validate(tuples::get<1>(future.get()));
+ Option<Error> error = validate(std::get<1>(future.get()));
if (error.isSome()) {
return error.get();
}
- Future<Result<T>> result = tuples::get<0>(future.get());
+ Future<Result<T>> result = std::get<0>(future.get());
if (result.isFailed()) {
return Error("Could not receive any result: " + result.failure());
}
@@ -670,7 +670,7 @@ void ExternalContainerizerProcess::__wait(
// the result validation below will return an error due to a non 0
// exit status.
if (actives[containerId]->destroying && future.isReady()) {
- Future<Option<int>> statusFuture = tuples::get<1>(future.get());
+ Future<Option<int>> statusFuture = std::get<1>(future.get());
if (statusFuture.isReady()) {
Option<int> status = statusFuture.get();
if (status.isSome()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3dfbd9b/src/slave/containerizer/external_containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.hpp b/src/slave/containerizer/external_containerizer.hpp
index 726a97f..c00cebb 100644
--- a/src/slave/containerizer/external_containerizer.hpp
+++ b/src/slave/containerizer/external_containerizer.hpp
@@ -22,6 +22,7 @@
#include <list>
#include <sstream>
#include <string>
+#include <tuple>
#include <process/owned.hpp>
#include <process/subprocess.hpp>
@@ -29,7 +30,6 @@
#include <stout/hashmap.hpp>
#include <stout/protobuf.hpp>
#include <stout/try.hpp>
-#include <stout/tuple.hpp>
#include "slave/state.hpp"
@@ -235,7 +235,7 @@ private:
void __wait(
const ContainerID& containerId,
- const process::Future<tuples::tuple<
+ const process::Future<std::tuple<
process::Future<Result<containerizer::Termination>>,
process::Future<Option<int>>>>& future);
@@ -252,7 +252,7 @@ private:
process::Future<ResourceStatistics> __usage(
const ContainerID& containerId,
- const process::Future<tuples::tuple<
+ const process::Future<std::tuple<
process::Future<Result<ResourceStatistics>>,
process::Future<Option<int>>>>& future);
@@ -263,7 +263,7 @@ private:
const process::Future<Option<int>>& future);
process::Future<hashset<ContainerID>> _containers(
- const process::Future<tuples::tuple<
+ const process::Future<std::tuple<
process::Future<Result<containerizer::Containers>>,
process::Future<Option<int>>>>& future);
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3dfbd9b/src/slave/containerizer/isolators/posix/disk.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/posix/disk.cpp b/src/slave/containerizer/isolators/posix/disk.cpp
index 73059bd..caf81e8 100644
--- a/src/slave/containerizer/isolators/posix/disk.cpp
+++ b/src/slave/containerizer/isolators/posix/disk.cpp
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <deque>
+#include <tuple>
#include <glog/logging.h>
@@ -39,7 +40,6 @@
#include <stout/lambda.hpp>
#include <stout/numify.hpp>
#include <stout/strings.hpp>
-#include <stout/tuple.hpp>
#include <stout/os/exists.hpp>
#include <stout/os/killtree.hpp>
@@ -430,7 +430,7 @@ private:
.onAny(defer(self(), &Self::_schedule, lambda::_1));
}
- void _schedule(const Future<tuples::tuple<
+ void _schedule(const Future<std::tuple<
Future<Option<int>>,
Future<string>,
Future<string>>>& future)
@@ -441,7 +441,7 @@ private:
const Owned<Entry>& entry = entries.front();
CHECK_SOME(entry->du);
- Future<Option<int>> status = tuples::get<0>(future.get());
+ Future<Option<int>> status = std::get<0>(future.get());
if (!status.isReady()) {
entry->promise.fail(
@@ -450,7 +450,7 @@ private:
} else if (status.get().isNone()) {
entry->promise.fail("Failed to reap the status of 'du'");
} else if (status.get().get() != 0) {
- Future<string> error = tuples::get<2>(future.get());
+ Future<string> error = std::get<2>(future.get());
if (!error.isReady()) {
entry->promise.fail(
"Failed to perform 'du'. Reading stderr failed: " +
@@ -459,7 +459,7 @@ private:
entry->promise.fail("Failed to perform 'du': " + error.get());
}
} else {
- Future<string> output = tuples::get<1>(future.get());
+ Future<string> output = std::get<1>(future.get());
if (!output.isReady()) {
entry->promise.fail(
"Failed to read stdout from 'du': " +
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3dfbd9b/src/zookeeper/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/zookeeper.cpp b/src/zookeeper/zookeeper.cpp
index d4c24cd..11ace5a 100644
--- a/src/zookeeper/zookeeper.cpp
+++ b/src/zookeeper/zookeeper.cpp
@@ -22,6 +22,7 @@
#include <iostream>
#include <map>
+#include <tuple>
#include <process/defer.hpp>
#include <process/dispatch.hpp>
@@ -34,7 +35,6 @@
#include <stout/foreach.hpp>
#include <stout/path.hpp>
#include <stout/strings.hpp>
-#include <stout/tuple.hpp>
#include <stout/unreachable.hpp>
#include "zookeeper/zookeeper.hpp"
@@ -43,11 +43,9 @@ using namespace process;
using std::map;
using std::string;
+using std::tuple;
using std::vector;
-using tuples::tuple;
-
-
class ZooKeeperProcess : public Process<ZooKeeperProcess>
{
public:
@@ -408,7 +406,7 @@ private:
const tuple<Promise<int>*>* args =
reinterpret_cast<const tuple<Promise<int>*>*>(data);
- Promise<int>* promise = tuples::get<0>(*args);
+ Promise<int>* promise = std::get<0>(*args);
promise->set(ret);
@@ -421,8 +419,8 @@ private:
const tuple<Promise<int>*, string*> *args =
reinterpret_cast<const tuple<Promise<int>*, string*>*>(data);
- Promise<int>* promise = tuples::get<0>(*args);
- string* result = tuples::get<1>(*args);
+ Promise<int>* promise = std::get<0>(*args);
+ string* result = std::get<1>(*args);
if (ret == 0) {
if (result != NULL) {
@@ -441,8 +439,8 @@ private:
const tuple<Promise<int>*, Stat*>* args =
reinterpret_cast<const tuple<Promise<int>*, Stat*>*>(data);
- Promise<int>* promise = tuples::get<0>(*args);
- Stat *stat_result = tuples::get<1>(*args);
+ Promise<int>* promise = std::get<0>(*args);
+ Stat *stat_result = std::get<1>(*args);
if (ret == 0) {
if (stat_result != NULL) {
@@ -466,9 +464,9 @@ private:
const tuple<Promise<int>*, string*, Stat*>* args =
reinterpret_cast<const tuple<Promise<int>*, string*, Stat*>*>(data);
- Promise<int>* promise = tuples::get<0>(*args);
- string* result = tuples::get<1>(*args);
- Stat* stat_result = tuples::get<2>(*args);
+ Promise<int>* promise = std::get<0>(*args);
+ string* result = std::get<1>(*args);
+ Stat* stat_result = std::get<2>(*args);
if (ret == 0) {
if (result != NULL) {
@@ -494,8 +492,8 @@ private:
const tuple<Promise<int>*, vector<string>*>* args =
reinterpret_cast<const tuple<Promise<int>*, vector<string>*>*>(data);
- Promise<int>* promise = tuples::get<0>(*args);
- vector<string>* results = tuples::get<1>(*args);
+ Promise<int>* promise = std::get<0>(*args);
+ vector<string>* results = std::get<1>(*args);
if (ret == 0) {
if (results != NULL) {
[02/10] mesos git commit: Removed pre-C++11 codepath in libprocess.
Posted by be...@apache.org.
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/deferred.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/deferred.hpp b/3rdparty/libprocess/include/process/deferred.hpp
index 8bdc692..352205b 100644
--- a/3rdparty/libprocess/include/process/deferred.hpp
+++ b/3rdparty/libprocess/include/process/deferred.hpp
@@ -1,160 +1,270 @@
-#if __cplusplus >= 201103L
-#include <process/c++11/deferred.hpp>
-#else
#ifndef __PROCESS_DEFERRED_HPP__
#define __PROCESS_DEFERRED_HPP__
-#include <tr1/functional>
+#include <functional>
-#include <process/future.hpp>
+#include <process/dispatch.hpp>
#include <process/pid.hpp>
#include <stout/preprocessor.hpp>
namespace process {
-// Forward declarations (removing these produces cryptic compiler
-// errors even though we are just using them to declare friends).
-class Executor;
-template <typename _F> struct _Defer;
-
-
// Acts like a function call but runs within an asynchronous execution
// context such as an Executor or a ProcessBase (enforced because only
// an executor or the 'defer' routines are allowed to create them).
template <typename F>
-struct Deferred : std::tr1::function<F>
+struct Deferred : std::function<F>
{
private:
- // Only an Executor and the 'defer' routines can create these.
friend class Executor;
- template <typename _F> friend struct _Defer;
+ template <typename G> friend struct _Deferred;
+
+ // TODO(benh): Consider removing these in favor of having these
+ // functions return _Deferred.
+ template <typename T>
+ friend Deferred<void(void)>
+ defer(const PID<T>& pid, void (T::*method)(void));
+
+ template <typename R, typename T>
+ friend Deferred<Future<R>(void)>
+ defer(const PID<T>& pid, Future<R> (T::*method)(void));
+
+ template <typename R, typename T>
+ friend Deferred<Future<R>(void)>
+ defer(const PID<T>& pid, R (T::*method)(void));
+
+ /*implicit*/ Deferred(const std::function<F>& f) : std::function<F>(f) {}
+};
+
+
+// We need an intermeidate "deferred" type because when constructing a
+// Deferred we won't always know the underlying function type (for
+// example, if we're being passed a std::bind or a lambda). A lambda
+// won't always implicitly convert to a std::function so instead we
+// hold onto the functor type F and let the compiler invoke the
+// necessary cast operator (below) when it actually has determined
+// what type is needed. This is similar in nature to how std::bind
+// works with it's intermediate _Bind type (which the pre-C++11
+// implementation relied on).
+template <typename F>
+struct _Deferred
+{
+ operator Deferred<void()> () const
+ {
+ // The 'pid' differentiates an already dispatched functor versus
+ // one which still needs to be dispatched (which is done
+ // below). We have to delay wrapping the dispatch (for example, in
+ // defer.hpp) as long as possible because we don't always know
+ // what type the functor is or is going to be cast to (i.e., a
+ // std::bind might can be cast to functions that do or do not take
+ // arguments which will just be dropped when invoking the
+ // underlying bound function).
+ if (pid.isNone()) {
+ return std::function<void()>(f);
+ }
+
+ // We need to explicitly copy the members otherwise we'll
+ // implicitly copy 'this' which might not exist at invocation.
+ Option<UPID> pid_ = pid;
+ F f_ = f;
+
+ return std::function<void()>(
+ [=] () {
+ dispatch(pid_.get(), std::function<void()>(f_));
+ });
+ }
+
+ operator std::function<void()> () const
+ {
+ if (pid.isNone()) {
+ return std::function<void()>(f);
+ }
+
+ Option<UPID> pid_ = pid;
+ F f_ = f;
+
+ return std::function<void()>(
+ [=] () {
+ dispatch(pid_.get(), std::function<void()>(f_));
+ });
+ }
+
+ template <typename R>
+ operator Deferred<R()> () const
+ {
+ if (pid.isNone()) {
+ return std::function<R()>(f);
+ }
+
+ Option<UPID> pid_ = pid;
+ F f_ = f;
+
+ return std::function<R()>(
+ [=] () {
+ return dispatch(pid_.get(), std::function<R()>(f_));
+ });
+ }
+
+ template <typename R>
+ operator std::function<R()> () const
+ {
+ if (pid.isNone()) {
+ return std::function<R()>(f);
+ }
- friend Deferred<void(void)> defer(
- const UPID& pid,
- const std::tr1::function<void(void)>& f);
+ Option<UPID> pid_ = pid;
+ F f_ = f;
- friend Deferred<void(void)> defer(
- const std::tr1::function<void(void)>& f);
+ return std::function<R()>(
+ [=] () {
+ return dispatch(pid_.get(), std::function<R()>(f_));
+ });
+ }
+ // Due to a bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933)
+ // with variadic templates and lambdas, we still need to do
+ // preprocessor expansions. In addition, due to a bug with clang (or
+ // libc++) we can't use std::bind with a std::function so we have to
+ // explicitely use the std::function<R(P...)>::operator() (see
+ // http://stackoverflow.com/questions/20097616/stdbind-to-a-stdfunction-crashes-with-clang).
#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename A)> \
- friend Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const UPID& pid, \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f); \
+ template <ENUM_PARAMS(N, typename P)> \
+ operator Deferred<void(ENUM_PARAMS(N, P))> () const \
+ { \
+ if (pid.isNone()) { \
+ return std::function<void(ENUM_PARAMS(N, P))>(f); \
+ } \
+ \
+ Option<UPID> pid_ = pid; \
+ F f_ = f; \
\
- template <ENUM_PARAMS(N, typename A)> \
- friend Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f); \
+ return std::function<void(ENUM_PARAMS(N, P))>( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ std::function<void()> f__([=] () { \
+ f_(ENUM_PARAMS(N, p)); \
+ }); \
+ dispatch(pid_.get(), f__); \
+ }); \
+ } \
\
- template <typename R, ENUM_PARAMS(N, typename A)> \
- friend Deferred<Future<R>(ENUM_PARAMS(N, A))> defer( \
- const UPID& pid, \
- const std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>& f); \
+ template <ENUM_PARAMS(N, typename P)> \
+ operator std::function<void(ENUM_PARAMS(N, P))> () const \
+ { \
+ if (pid.isNone()) { \
+ return std::function<void(ENUM_PARAMS(N, P))>(f); \
+ } \
\
- template <typename R, ENUM_PARAMS(N, typename A)> \
- friend Deferred<Future<R>(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::function<Future<R>(ENUM_PARAMS(N, A))>& f);
+ Option<UPID> pid_ = pid; \
+ F f_ = f; \
+ \
+ return std::function<void(ENUM_PARAMS(N, P))>( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ std::function<void()> f__([=] () { \
+ f_(ENUM_PARAMS(N, p)); \
+ }); \
+ dispatch(pid_.get(), f__); \
+ }); \
+ }
REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
#undef TEMPLATE
- /*implicit*/ Deferred(const std::tr1::function<F>& f)
- : std::tr1::function<F>(f) {}
-};
-
-
-// The result of invoking the 'defer' routines is actually an internal
-// type, effectively just a wrapper around the result of invoking
-// 'std::tr1::bind'. However, we want the result of bind to be
-// castable to a 'Deferred' but we don't want anyone to be able to
-// create a 'Deferred' so we use a level-of-indirection via this type.
-template <typename F>
-struct _Defer : std::tr1::_Bind<F>
-{
- template <typename _F>
- operator Deferred<_F> ()
- {
- return Deferred<_F>(std::tr1::function<_F>(*this));
+#define TEMPLATE(Z, N, DATA) \
+ template <typename R, ENUM_PARAMS(N, typename P)> \
+ operator Deferred<R(ENUM_PARAMS(N, P))> () const \
+ { \
+ if (pid.isNone()) { \
+ return std::function<R(ENUM_PARAMS(N, P))>(f); \
+ } \
+ \
+ Option<UPID> pid_ = pid; \
+ F f_ = f; \
+ \
+ return std::function<R(ENUM_PARAMS(N, P))>( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ std::function<R()> f__([=] () { \
+ return f_(ENUM_PARAMS(N, p)); \
+ }); \
+ return dispatch(pid_.get(), f__); \
+ }); \
+ } \
+ \
+ template <typename R, ENUM_PARAMS(N, typename P)> \
+ operator std::function<R(ENUM_PARAMS(N, P))> () const \
+ { \
+ if (pid.isNone()) { \
+ return std::function<R(ENUM_PARAMS(N, P))>(f); \
+ } \
+ \
+ Option<UPID> pid_ = pid; \
+ F f_ = f; \
+ \
+ return std::function<R(ENUM_PARAMS(N, P))>( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ std::function<R()> f__([=] () { \
+ return f_(ENUM_PARAMS(N, p)); \
+ }); \
+ return dispatch(pid_.get(), f__); \
+ }); \
}
+ REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
+#undef TEMPLATE
+
private:
friend class Executor;
- template <typename T>
- friend _Defer<void(*(PID<T>, void (T::*)(void)))
- (const PID<T>&, void (T::*)(void))>
- defer(const PID<T>& pid, void (T::*method)(void));
+ template <typename G>
+ friend _Deferred<G> defer(const UPID& pid, G&& g);
#define TEMPLATE(Z, N, DATA) \
template <typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- friend _Defer<void(*(PID<T>, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- void (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const PID<T>& pid, \
- void (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a));
+ friend auto defer(const PID<T>& pid, \
+ void (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> _Deferred<decltype(std::bind(&std::function<void(ENUM_PARAMS(N, P))>::operator(), std::function<void(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))>; // NOLINT(whitespace/line_length)
REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
#undef TEMPLATE
- template <typename R, typename T>
- friend _Defer<Future<R>(*(PID<T>, Future<R> (T::*)(void)))(
- const PID<T>&, Future<R> (T::*)(void))>
- defer(const PID<T>& pid, Future<R> (T::*method)(void));
-
#define TEMPLATE(Z, N, DATA) \
template <typename R, \
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- friend _Defer<Future<R>(*(PID<T>, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- Future<R> (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const PID<T>& pid, \
- Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a));
+ friend auto defer(const PID<T>& pid, \
+ Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))>; // NOLINT(whitespace/line_length)
REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
#undef TEMPLATE
- template <typename R, typename T>
- friend _Defer<Future<R>(*(PID<T>, R (T::*)(void)))(
- const PID<T>&, R (T::*)(void))>
- defer(const PID<T>& pid, R (T::*method)(void));
-
#define TEMPLATE(Z, N, DATA) \
template <typename R, \
typename T, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
- friend _Defer<Future<R>(*(PID<T>, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<T>&, \
- R (T::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))> \
- defer(const PID<T>& pid, \
- R (T::*method)(ENUM_PARAMS(N, P)), \
- ENUM_BINARY_PARAMS(N, A, a));
+ friend auto defer(const PID<T>& pid, \
+ R (T::*method)(ENUM_PARAMS(N, P)), \
+ ENUM_BINARY_PARAMS(N, A, a)) \
+ -> _Deferred<decltype(std::bind(&std::function<Future<R>(ENUM_PARAMS(N, P))>::operator(), std::function<Future<R>(ENUM_PARAMS(N, P))>(), ENUM_PARAMS(N, a)))>; // NOLINT(whitespace/line_length)
REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
#undef TEMPLATE
- /*implicit*/ _Defer(const std::tr1::_Bind<F>& b)
- : std::tr1::_Bind<F>(b) {}
+ _Deferred(const UPID& pid, F f) : pid(pid), f(f) {}
+
+ /*implicit*/ _Deferred(F f) : f(f) {}
+
+ Option<UPID> pid;
+ F f;
};
} // namespace process {
#endif // __PROCESS_DEFERRED_HPP__
-#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/delay.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/delay.hpp b/3rdparty/libprocess/include/process/delay.hpp
index be2d36b..5818e83 100644
--- a/3rdparty/libprocess/include/process/delay.hpp
+++ b/3rdparty/libprocess/include/process/delay.hpp
@@ -1,6 +1,3 @@
-#if __cplusplus >= 201103L
-#include <process/c++11/delay.hpp>
-#else
#ifndef __PROCESS_DELAY_HPP__
#define __PROCESS_DELAY_HPP__
@@ -9,8 +6,6 @@
#include <process/timer.hpp>
#include <stout/duration.hpp>
-#include <stout/lambda.hpp>
-#include <stout/memory.hpp>
#include <stout/preprocessor.hpp>
namespace process {
@@ -25,23 +20,9 @@ Timer delay(const Duration& duration,
const PID<T>& pid,
void (T::*method)())
{
- memory::shared_ptr<lambda::function<void(T*)> > thunk(
- new lambda::function<void(T*)>(
- lambda::bind(method, lambda::_1)));
-
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher(
- new lambda::function<void(ProcessBase*)>(
- lambda::bind(&internal::vdispatcher<T>,
- lambda::_1,
- thunk)));
-
- lambda::function<void(void)> dispatch =
- lambda::bind(internal::dispatch,
- pid,
- dispatcher,
- &typeid(method));
-
- return Clock::timer(duration, dispatch);
+ return Clock::timer(duration, [=] () {
+ dispatch(pid, method);
+ });
}
@@ -72,23 +53,9 @@ Timer delay(const Duration& duration,
void (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- memory::shared_ptr<lambda::function<void(T*)> > thunk( \
- new lambda::function<void(T*)>( \
- lambda::bind(method, lambda::_1, ENUM_PARAMS(N, a)))); \
- \
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher( \
- new lambda::function<void(ProcessBase*)>( \
- lambda::bind(&internal::vdispatcher<T>, \
- lambda::_1, \
- thunk))); \
- \
- lambda::function<void(void)> dispatch = \
- lambda::bind(internal::dispatch, \
- pid, \
- dispatcher, \
- &typeid(method)); \
- \
- return Clock::timer(duration, dispatch); \
+ return Clock::timer(duration, [=] () { \
+ dispatch(pid, method, ENUM_PARAMS(N, a)); \
+ }); \
} \
\
template <typename T, \
@@ -119,4 +86,3 @@ Timer delay(const Duration& duration,
} // namespace process {
#endif // __PROCESS_DELAY_HPP__
-#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/dispatch.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/dispatch.hpp b/3rdparty/libprocess/include/process/dispatch.hpp
index 4ec07d6..99de0e9 100644
--- a/3rdparty/libprocess/include/process/dispatch.hpp
+++ b/3rdparty/libprocess/include/process/dispatch.hpp
@@ -1,15 +1,12 @@
-#if __cplusplus >= 201103L
-#include <process/c++11/dispatch.hpp>
-#else
#ifndef __PROCESS_DISPATCH_HPP__
#define __PROCESS_DISPATCH_HPP__
+#include <functional>
+#include <memory> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <string>
#include <process/process.hpp>
-#include <stout/lambda.hpp>
-#include <stout/memory.hpp> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <stout/preprocessor.hpp>
namespace process {
@@ -53,54 +50,9 @@ namespace internal {
// will probably change in the future to unique_ptr (or a variant).
void dispatch(
const UPID& pid,
- const memory::shared_ptr<lambda::function<void(ProcessBase*)> >& f,
+ const std::shared_ptr<std::function<void(ProcessBase*)>>& f,
const Option<const std::type_info*>& functionType = None());
-// For each return type (void, future, value) there is a dispatcher
-// function which should complete the picture. Given the process
-// argument these routines downcast the process to the correct subtype
-// and invoke the thunk using the subtype as the argument
-// (receiver). Note that we must use dynamic_cast because we permit a
-// process to use multiple inheritance (e.g., to expose multiple
-// callback interfaces).
-
-template <typename T>
-void vdispatcher(
- ProcessBase* process,
- memory::shared_ptr<lambda::function<void(T*)> > thunk)
-{
- assert(process != NULL);
- T* t = dynamic_cast<T*>(process);
- CHECK_NOTNULL(t);
- (*thunk)(t);
-}
-
-
-template <typename R, typename T>
-void pdispatcher(
- ProcessBase* process,
- memory::shared_ptr<lambda::function<Future<R>(T*)> > thunk,
- memory::shared_ptr<Promise<R> > promise)
-{
- CHECK_NOTNULL(process);
- T* t = dynamic_cast<T*>(process);
- CHECK_NOTNULL(t);
- promise->associate((*thunk)(t));
-}
-
-
-template <typename R, typename T>
-void rdispatcher(
- ProcessBase* process,
- memory::shared_ptr<lambda::function<R(T*)> > thunk,
- memory::shared_ptr<Promise<R> > promise)
-{
- CHECK_NOTNULL(process);
- T* t = dynamic_cast<T*>(process);
- CHECK_NOTNULL(t);
- promise->set((*thunk)(t));
-}
-
} // namespace internal {
@@ -111,50 +63,28 @@ void rdispatcher(
// would shorten these definitions even more.
//
// First, definitions of dispatch for methods returning void:
-//
-// template <typename T, typename ...P>
-// void dispatch(
-// const PID<T>& pid,
-// void (T::*method)(P...),
-// P... p)
-// {
-// memory::shared_ptr<lambda::function<void(T*)> > thunk(
-// new lambda::function<void(T*)>(
-// lambda::bind(method,
-// lambda::_1,
-// std::forward<P>(p)...)));
-//
-// memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher(
-// new lambda::function<void(ProcessBase*)>(
-// lambda::bind(&internal::vdispatcher<T>,
-// lambda::_1,
-// thunk)));
-//
-// internal::dispatch(pid, dispatcher, &typeid(method));
-// }
template <typename T>
void dispatch(
const PID<T>& pid,
- void (T::*method)(void))
+ void (T::*method)())
{
- memory::shared_ptr<lambda::function<void(T*)> > thunk(
- new lambda::function<void(T*)>(
- lambda::bind(method, lambda::_1)));
-
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher(
- new lambda::function<void(ProcessBase*)>(
- lambda::bind(&internal::vdispatcher<T>,
- lambda::_1,
- thunk)));
-
- internal::dispatch(pid, dispatcher, &typeid(method));
+ std::shared_ptr<std::function<void(ProcessBase*)>> f(
+ new std::function<void(ProcessBase*)>(
+ [=] (ProcessBase* process) {
+ assert(process != NULL);
+ T* t = dynamic_cast<T*>(process);
+ assert(t != NULL);
+ (t->*method)();
+ }));
+
+ internal::dispatch(pid, f, &typeid(method));
}
template <typename T>
void dispatch(
const Process<T>& process,
- void (T::*method)(void))
+ void (T::*method)())
{
dispatch(process.self(), method);
}
@@ -162,11 +92,14 @@ void dispatch(
template <typename T>
void dispatch(
const Process<T>* process,
- void (T::*method)(void))
+ void (T::*method)())
{
dispatch(process->self(), method);
}
+// Due to a bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933)
+// with variadic templates and lambdas, we still need to do
+// preprocessor expansions.
#define TEMPLATE(Z, N, DATA) \
template <typename T, \
ENUM_PARAMS(N, typename P), \
@@ -176,19 +109,16 @@ void dispatch(
void (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- memory::shared_ptr<lambda::function<void(T*)> > thunk( \
- new lambda::function<void(T*)>( \
- lambda::bind(method, \
- lambda::_1, \
- ENUM_PARAMS(N, a)))); \
+ std::shared_ptr<std::function<void(ProcessBase*)>> f( \
+ new std::function<void(ProcessBase*)>( \
+ [=] (ProcessBase* process) { \
+ assert(process != NULL); \
+ T* t = dynamic_cast<T*>(process); \
+ assert(t != NULL); \
+ (t->*method)(ENUM_PARAMS(N, a)); \
+ })); \
\
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher( \
- new lambda::function<void(ProcessBase*)>( \
- lambda::bind(&internal::vdispatcher<T>, \
- lambda::_1, \
- thunk))); \
- \
- internal::dispatch(pid, dispatcher, &typeid(method)); \
+ internal::dispatch(pid, f, &typeid(method)); \
} \
\
template <typename T, \
@@ -218,54 +148,26 @@ void dispatch(
// Next, definitions of methods returning a future:
-//
-// template <typename R, typename T, typename ...P>
-// Future<R> dispatch(
-// const PID<T>& pid,
-// Future<R> (T::*method)(P...),
-// P... p)
-// {
-// memory::shared_ptr<lambda::function<Future<R>(T*)> > thunk(
-// new lambda::function<Future<R>(T*)>(
-// lambda::bind(method,
-// lambda::_1,
-// std::forward<P>(p)...)));
-//
-// memory::shared_ptr<Promise<R> > promise(new Promise<R>());
-// Future<R> future = promise->future();
-//
-// memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher(
-// new lambda::function<void(ProcessBase*)>(
-// lambda::bind(&internal::pdispatcher<R, T>,
-// lambda::_1,
-// thunk, promise)));
-//
-// internal::dispatch(pid, dispatcher, &typeid(method));
-//
-// return future;
-// }
template <typename R, typename T>
Future<R> dispatch(
const PID<T>& pid,
- Future<R> (T::*method)(void))
+ Future<R> (T::*method)())
{
- memory::shared_ptr<lambda::function<Future<R>(T*)> > thunk(
- new lambda::function<Future<R>(T*)>(
- lambda::bind(method, lambda::_1)));
-
- memory::shared_ptr<Promise<R> > promise(new Promise<R>());
- Future<R> future = promise->future();
+ std::shared_ptr<Promise<R>> promise(new Promise<R>());
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher(
- new lambda::function<void(ProcessBase*)>(
- lambda::bind(&internal::pdispatcher<R, T>,
- lambda::_1,
- thunk, promise)));
+ std::shared_ptr<std::function<void(ProcessBase*)>> f(
+ new std::function<void(ProcessBase*)>(
+ [=] (ProcessBase* process) {
+ assert(process != NULL);
+ T* t = dynamic_cast<T*>(process);
+ assert(t != NULL);
+ promise->associate((t->*method)());
+ }));
- internal::dispatch(pid, dispatcher, &typeid(method));
+ internal::dispatch(pid, f, &typeid(method));
- return future;
+ return promise->future();
}
template <typename R, typename T>
@@ -294,24 +196,20 @@ Future<R> dispatch(
Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- memory::shared_ptr<lambda::function<Future<R>(T*)> > thunk( \
- new lambda::function<Future<R>(T*)>( \
- lambda::bind(method, \
- lambda::_1, \
- ENUM_PARAMS(N, a)))); \
+ std::shared_ptr<Promise<R>> promise(new Promise<R>()); \
\
- memory::shared_ptr<Promise<R> > promise(new Promise<R>()); \
- Future<R> future = promise->future(); \
+ std::shared_ptr<std::function<void(ProcessBase*)>> f( \
+ new std::function<void(ProcessBase*)>( \
+ [=] (ProcessBase* process) { \
+ assert(process != NULL); \
+ T* t = dynamic_cast<T*>(process); \
+ assert(t != NULL); \
+ promise->associate((t->*method)(ENUM_PARAMS(N, a))); \
+ })); \
\
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher( \
- new lambda::function<void(ProcessBase*)>( \
- lambda::bind(&internal::pdispatcher<R, T>, \
- lambda::_1, \
- thunk, promise))); \
+ internal::dispatch(pid, f, &typeid(method)); \
\
- internal::dispatch(pid, dispatcher, &typeid(method)); \
- \
- return future; \
+ return promise->future(); \
} \
\
template <typename R, \
@@ -343,60 +241,32 @@ Future<R> dispatch(
// Next, definitions of methods returning a value.
-//
-// template <typename R, typename T, typename ...P>
-// Future<R> dispatch(
-// const PID<T>& pid,
-// R (T::*method)(P...),
-// P... p)
-// {
-// memory::shared_ptr<lambda::function<R(T*)> > thunk(
-// new lambda::function<R(T*)>(
-// lambda::bind(method,
-// lambda::_1,
-// std::forward<P>(p)...)));
-//
-// memory::shared_ptr<Promise<R> > promise(new Promise<R>());
-// Future<R> future = promise->future();
-//
-// memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher(
-// new lambda::function<void(ProcessBase*)>(
-// lambda::bind(&internal::rdispatcher<R, T>,
-// lambda::_1,
-// thunk, promise)));
-//
-// internal::dispatch(pid, dispatcher, &typeid(method));
-//
-// return future;
-// }
template <typename R, typename T>
Future<R> dispatch(
const PID<T>& pid,
R (T::*method)(void))
{
- memory::shared_ptr<lambda::function<R(T*)> > thunk(
- new lambda::function<R(T*)>(
- lambda::bind(method, lambda::_1)));
-
- memory::shared_ptr<Promise<R> > promise(new Promise<R>());
- Future<R> future = promise->future();
+ std::shared_ptr<Promise<R>> promise(new Promise<R>());
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher(
- new lambda::function<void(ProcessBase*)>(
- lambda::bind(&internal::rdispatcher<R, T>,
- lambda::_1,
- thunk, promise)));
+ std::shared_ptr<std::function<void(ProcessBase*)>> f(
+ new std::function<void(ProcessBase*)>(
+ [=] (ProcessBase* process) {
+ assert(process != NULL);
+ T* t = dynamic_cast<T*>(process);
+ assert(t != NULL);
+ promise->set((t->*method)());
+ }));
- internal::dispatch(pid, dispatcher, &typeid(method));
+ internal::dispatch(pid, f, &typeid(method));
- return future;
+ return promise->future();
}
template <typename R, typename T>
Future<R> dispatch(
const Process<T>& process,
- R (T::*method)(void))
+ R (T::*method)())
{
return dispatch(process.self(), method);
}
@@ -404,7 +274,7 @@ Future<R> dispatch(
template <typename R, typename T>
Future<R> dispatch(
const Process<T>* process,
- R (T::*method)(void))
+ R (T::*method)())
{
return dispatch(process->self(), method);
}
@@ -419,24 +289,20 @@ Future<R> dispatch(
R (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- memory::shared_ptr<lambda::function<R(T*)> > thunk( \
- new lambda::function<R(T*)>( \
- lambda::bind(method, \
- lambda::_1, \
- ENUM_PARAMS(N, a)))); \
+ std::shared_ptr<Promise<R>> promise(new Promise<R>()); \
\
- memory::shared_ptr<Promise<R> > promise(new Promise<R>()); \
- Future<R> future = promise->future(); \
+ std::shared_ptr<std::function<void(ProcessBase*)>> f( \
+ new std::function<void(ProcessBase*)>( \
+ [=] (ProcessBase* process) { \
+ assert(process != NULL); \
+ T* t = dynamic_cast<T*>(process); \
+ assert(t != NULL); \
+ promise->set((t->*method)(ENUM_PARAMS(N, a))); \
+ })); \
\
- memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher( \
- new lambda::function<void(ProcessBase*)>( \
- lambda::bind(&internal::rdispatcher<R, T>, \
- lambda::_1, \
- thunk, promise))); \
+ internal::dispatch(pid, f, &typeid(method)); \
\
- internal::dispatch(pid, dispatcher, &typeid(method)); \
- \
- return future; \
+ return promise->future(); \
} \
\
template <typename R, \
@@ -466,7 +332,58 @@ Future<R> dispatch(
REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
#undef TEMPLATE
+
+inline void dispatch(
+ const UPID& pid,
+ const std::function<void()>& f)
+{
+ std::shared_ptr<std::function<void(ProcessBase*)>> f_(
+ new std::function<void(ProcessBase*)>(
+ [=] (ProcessBase*) {
+ f();
+ }));
+
+ internal::dispatch(pid, f_);
+}
+
+
+template <typename R>
+Future<R> dispatch(
+ const UPID& pid,
+ const std::function<Future<R>()>& f)
+{
+ std::shared_ptr<Promise<R>> promise(new Promise<R>());
+
+ std::shared_ptr<std::function<void(ProcessBase*)>> f_(
+ new std::function<void(ProcessBase*)>(
+ [=] (ProcessBase*) {
+ promise->associate(f());
+ }));
+
+ internal::dispatch(pid, f_);
+
+ return promise->future();
+}
+
+
+template <typename R>
+Future<R> dispatch(
+ const UPID& pid,
+ const std::function<R()>& f)
+{
+ std::shared_ptr<Promise<R>> promise(new Promise<R>());
+
+ std::shared_ptr<std::function<void(ProcessBase*)>> f_(
+ new std::function<void(ProcessBase*)>(
+ [=] (ProcessBase*) {
+ promise->set(f());
+ }));
+
+ internal::dispatch(pid, f_);
+
+ return promise->future();
+}
+
} // namespace process {
#endif // __PROCESS_DISPATCH_HPP__
-#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/executor.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/executor.hpp b/3rdparty/libprocess/include/process/executor.hpp
index e28790e..157a1d2 100644
--- a/3rdparty/libprocess/include/process/executor.hpp
+++ b/3rdparty/libprocess/include/process/executor.hpp
@@ -1,61 +1,23 @@
-#if __cplusplus >= 201103L
-#include <process/c++11/executor.hpp>
-#else
#ifndef __PROCESS_EXECUTOR_HPP__
#define __PROCESS_EXECUTOR_HPP__
+#include <process/defer.hpp>
#include <process/deferred.hpp>
-#include <process/dispatch.hpp>
#include <process/id.hpp>
+#include <process/process.hpp>
-#include <stout/preprocessor.hpp>
#include <stout/thread.hpp>
namespace process {
-namespace internal {
-
-// Underlying "process" which handles invoking actual callbacks
-// created through an Executor.
-class ExecutorProcess : public Process<ExecutorProcess>
-{
-private:
- friend class process::Executor;
-
- ExecutorProcess() : ProcessBase(ID::generate("__executor__")) {}
- virtual ~ExecutorProcess() {}
-
- // Not copyable, not assignable.
- ExecutorProcess(const ExecutorProcess&);
- ExecutorProcess& operator = (const ExecutorProcess&);
-
- // No arg invoke.
- void invoke(const std::tr1::function<void(void)>& f) { f(); }
-
- // Args invoke.
-#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename A)> \
- void CAT(invoke, N)( \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f, \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- f(ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-};
-
-} // namespace internal {
-
-
// Provides an abstraction that can take a standard function object
-// and convert it to a 'Deferred'. Each converted function object will
-// get invoked serially with respect to one another.
+// and defer it without needing a process. Each converted function
+// object will get execute serially with respect to one another when
+// invoked.
class Executor
{
public:
- Executor()
+ Executor() : process(ID::generate("__executor__"))
{
spawn(process);
}
@@ -68,7 +30,7 @@ public:
void stop()
{
- terminate(process);
+ terminate(&process);
// TODO(benh): Note that this doesn't wait because that could
// cause a deadlock ... thus, the semantics here are that no more
@@ -76,180 +38,19 @@ public:
// be occuring concurrently.
}
- // We can't easily use 'std::tr1::_Placeholder<X>' when doing macro
- // expansion via ENUM_BINARY_PARAMS because compilers don't like it
- // when you try and concatenate '<' 'N' '>'. Thus, we typedef them.
-private:
-#define TEMPLATE(Z, N, DATA) \
- typedef std::tr1::_Placeholder<INC(N)> _ ## N;
-
- REPEAT(10, TEMPLATE, _)
-#undef TEMPLATE
-
-public:
- // We provide wrappers for all standard function objects.
- Deferred<void(void)> defer(
- const std::tr1::function<void(void)>& f)
- {
- return Deferred<void(void)>(
- std::tr1::bind(
- &Executor::dispatcher,
- process.self(), f));
- }
-
-#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f) \
- { \
- return Deferred<void(ENUM_PARAMS(N, A))>( \
- std::tr1::bind( \
- &Executor::CAT(dispatcher, N)<ENUM_PARAMS(N, A)>, \
- process.self(), f, \
- ENUM_BINARY_PARAMS(N, _, () INTERCEPT))); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
- // Unfortunately, it is currently difficult to "forward" type
- // information from one result to another, so we must explicilty
- // define wrappers for all std::tr1::bind results. First we start
- // with the non-member std::tr1::bind results.
- Deferred<void(void)> defer(
- const std::tr1::_Bind<void(*(void))(void)>& b)
+ template <typename F>
+ _Deferred<F> defer(F&& f)
{
- return defer(std::tr1::function<void(void)>(b));
- }
-
-#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind< \
- void(*(ENUM_PARAMS(N, _))) \
- (ENUM_PARAMS(N, A))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
+ return _Deferred<F>(process.self(), std::forward<F>(f));
}
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
- // Now the member std::tr1::bind results:
- // 1. Non-const member (function), non-const pointer (receiver).
- // 2. Const member, non-const pointer.
- // 3. Const member, const pointer.
- // 4. Non-const member, non-const reference.
- // 5. Const member, non-const reference.
- // 6. Const member, const reference.
- // 7. Non-const member, value.
- // 8. Const member, value.
-#define TEMPLATE(Z, N, DATA) \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A))> \
- (T* ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- } \
- \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A)) const> \
- (T* ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- } \
- \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A)) const> \
- (const T* ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- } \
- \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A))> \
- (std::tr1::reference_wrapper<T> ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- } \
- \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A)) const> \
- (std::tr1::reference_wrapper<T> ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- } \
- \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A)) const> \
- (std::tr1::reference_wrapper<const T> ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- } \
- \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A))> \
- (T ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- } \
- \
- template <typename T ENUM_TRAILING_PARAMS(N, typename A)> \
- Deferred<void(ENUM_PARAMS(N, A))> defer( \
- const std::tr1::_Bind<std::tr1::_Mem_fn< \
- void(T::*)(ENUM_PARAMS(N, A)) const> \
- (T ENUM_TRAILING_PARAMS(N, _))>& b) \
- { \
- return defer(std::tr1::function<void(ENUM_PARAMS(N, A))>(b)); \
- }
-
- REPEAT(11, TEMPLATE, _) // No args and args A0 -> A9.
-#undef TEMPLATE
private:
// Not copyable, not assignable.
Executor(const Executor&);
Executor& operator = (const Executor&);
- static void dispatcher(
- const PID<internal::ExecutorProcess>& pid,
- const std::tr1::function<void(void)>& f)
- {
- // TODO(benh): Why not just use internal::dispatch?
- dispatch(pid, &internal::ExecutorProcess::invoke, f);
- }
-
-#define TEMPLATE(Z, N, DATA) \
- template <ENUM_PARAMS(N, typename A)> \
- static void CAT(dispatcher, N)( \
- const PID<internal::ExecutorProcess>& pid, \
- const std::tr1::function<void(ENUM_PARAMS(N, A))>& f, \
- ENUM_BINARY_PARAMS(N, A, a)) \
- { \
- dispatch( \
- pid, \
- &internal::ExecutorProcess::CAT(invoke, N)<ENUM_PARAMS(N, A)>, \
- f, ENUM_PARAMS(N, a)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
- internal::ExecutorProcess process;
+ ProcessBase process;
};
@@ -265,4 +66,3 @@ extern ThreadLocal<Executor>* _executor_;
} // namespace process {
#endif // __PROCESS_EXECUTOR_HPP__
-#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/future.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/future.hpp b/3rdparty/libprocess/include/process/future.hpp
index 530e153..9d301d7 100644
--- a/3rdparty/libprocess/include/process/future.hpp
+++ b/3rdparty/libprocess/include/process/future.hpp
@@ -7,17 +7,11 @@
#include <iostream>
#include <list>
#include <set>
-#if __cplusplus >= 201103L
#include <type_traits>
-#endif // __cplusplus >= 201103L
#include <vector>
#include <glog/logging.h>
-#if __cplusplus < 201103L
-#include <boost/type_traits.hpp>
-#endif // __cplusplus < 201103L
-
#include <process/clock.hpp>
#include <process/internal.hpp>
#include <process/latch.hpp>
@@ -41,13 +35,8 @@ namespace process {
template <typename _F>
struct _Defer;
-template <typename F>
-struct Deferred;
-
-#if __cplusplus >= 201103L
template <typename G>
struct _Deferred;
-#endif // __cplusplus >= 201103L
template <typename T>
class Future;
@@ -152,7 +141,6 @@ public:
typedef lambda::function<void(void)> DiscardedCallback;
typedef lambda::function<void(const Future<T>&)> AnyCallback;
-#if __cplusplus >= 201103L
// Installs callbacks for the specified events and returns a const
// reference to 'this' in order to easily support chaining.
const Future<T>& onDiscard(DiscardCallback&& callback) const;
@@ -297,17 +285,6 @@ public:
return onAny(std::forward<F>(f), Prefer());
}
-#else // __cplusplus >= 201103L
-
- // Installs callbacks for the specified events and returns a const
- // reference to 'this' in order to easily support chaining.
- const Future<T>& onDiscard(const DiscardCallback& callback) const;
- const Future<T>& onReady(const ReadyCallback& callback) const;
- const Future<T>& onFailed(const FailedCallback& callback) const;
- const Future<T>& onDiscarded(const DiscardedCallback& callback) const;
- const Future<T>& onAny(const AnyCallback& callback) const;
-#endif // __cplusplus >= 201103L
-
// Installs callbacks that get executed when this future is ready
// and associates the result of the callback with the future that is
// returned to the caller (which may be of a different type).
@@ -329,13 +306,6 @@ public:
return then(lambda::function<X(const T&)>(lambda::bind(f)));
}
- template <typename X>
- Future<X> then(const Deferred<Future<X>(T)>& f) const
- {
- return then(lambda::function<Future<X>(const T&)>(f));
- }
-
-#if __cplusplus >= 201103L
private:
template <typename F, typename X = typename internal::unwrap<typename std::result_of<F(const T&)>::type>::type> // NOLINT(whitespace/line_length)
Future<X> then(_Deferred<F>&& f, Prefer) const
@@ -371,103 +341,6 @@ public:
return then(std::forward<F>(f), Prefer());
}
-#else // __cplusplus >= 201103L
-
- // Helpers for the compiler to be able to forward std::tr1::bind results.
- template <typename X>
- Future<X> then(const std::tr1::_Bind<X(*(void))(void)>& b) const
- {
- return then(std::tr1::function<X(const T&)>(b));
- }
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename X, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<X> then( \
- const std::tr1::_Bind<X(*(ENUM_PARAMS(N, A))) \
- (ENUM_PARAMS(N, P))>& b) const \
- { \
- return then(std::tr1::function<X(const T&)>(b)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
- template <typename X>
- Future<X> then(const std::tr1::_Bind<Future<X>(*(void))(void)>& b) const
- {
- return then(std::tr1::function<Future<X>(const T&)>(b));
- }
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename X, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<X> then( \
- const std::tr1::_Bind<Future<X>(*(ENUM_PARAMS(N, A))) \
- (ENUM_PARAMS(N, P))>& b) const \
- { \
- return then(std::tr1::function<Future<X>(const T&)>(b)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
- // Helpers for the compiler to be able to forward 'defer' results.
- template <typename X, typename U>
- Future<X> then(const _Defer<Future<X>(*(PID<U>, X(U::*)(void)))
- (const PID<U>&, X(U::*)(void))>& d) const
- {
- return then(std::tr1::function<Future<X>(const T&)>(d));
- }
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename X, \
- typename U, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<X> then( \
- const _Defer<Future<X>(*(PID<U>, \
- X(U::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<U>&, \
- X(U::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))>& d) const \
- { \
- return then(std::tr1::function<Future<X>(const T&)>(d)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-
- template <typename X, typename U>
- Future<X> then(const _Defer<Future<X>(*(PID<U>, Future<X>(U::*)(void)))
- (const PID<U>&, Future<X>(U::*)(void))>& d) const
- {
- return then(std::tr1::function<Future<X>(const T&)>(d));
- }
-
-#define TEMPLATE(Z, N, DATA) \
- template <typename X, \
- typename U, \
- ENUM_PARAMS(N, typename P), \
- ENUM_PARAMS(N, typename A)> \
- Future<X> then( \
- const _Defer<Future<X>(*(PID<U>, \
- Future<X>(U::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, A))) \
- (const PID<U>&, \
- Future<X>(U::*)(ENUM_PARAMS(N, P)), \
- ENUM_PARAMS(N, P))>& d) const \
- { \
- return then(std::tr1::function<Future<X>(const T&)>(d)); \
- }
-
- REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
-#undef TEMPLATE
-#endif // __cplusplus >= 201103L
-
// Installs callbacks that get executed if this future completes
// because it failed.
Future<T> repair(
@@ -848,7 +721,6 @@ Future<Future<T> > select(const std::set<Future<T> >& futures)
promise->future().onDiscard(
lambda::bind(&internal::discarded<Future<T> >, promise->future()));
-#if __cplusplus >= 201103L
typename std::set<Future<T>>::iterator iterator;
for (iterator = futures.begin(); iterator != futures.end(); ++iterator) {
// NOTE: We can't use std::bind with a std::function with Clang
@@ -858,15 +730,6 @@ Future<Future<T> > select(const std::set<Future<T> >& futures)
internal::select(future, promise);
});
}
-#else // __cplusplus >= 201103L
- lambda::function<void(const Future<T>&)> select =
- lambda::bind(&internal::select<T>, lambda::_1, promise);
-
- typename std::set<Future<T> >::iterator iterator;
- for (iterator = futures.begin(); iterator != futures.end(); ++iterator) {
- (*iterator).onAny(lambda::bind(select, lambda::_1));
- }
-#endif // __cplusplus >= 201103L
return promise->future();
}
@@ -1191,7 +1054,6 @@ const std::string& Future<T>::failure() const
}
-#if __cplusplus >= 201103L
template <typename T>
const Future<T>& Future<T>::onDiscard(DiscardCallback&& callback) const
{
@@ -1311,128 +1173,6 @@ const Future<T>& Future<T>::onAny(AnyCallback&& callback) const
return *this;
}
-#else // __cplusplus >= 201103L
-template <typename T>
-const Future<T>& Future<T>::onDiscard(const DiscardCallback& callback) const
-{
- bool run = false;
-
- internal::acquire(&data->lock);
- {
- if (data->discard) {
- run = true;
- } else if (data->state == PENDING) {
- data->onDiscardCallbacks.push_back(callback);
- }
- }
- internal::release(&data->lock);
-
- // TODO(*): Invoke callback in another execution context.
- if (run) {
- callback();
- }
-
- return *this;
-}
-
-
-template <typename T>
-const Future<T>& Future<T>::onReady(const ReadyCallback& callback) const
-{
- bool run = false;
-
- internal::acquire(&data->lock);
- {
- if (data->state == READY) {
- run = true;
- } else if (data->state == PENDING) {
- data->onReadyCallbacks.push_back(callback);
- }
- }
- internal::release(&data->lock);
-
- // TODO(*): Invoke callback in another execution context.
- if (run) {
- callback(*data->t);
- }
-
- return *this;
-}
-
-
-template <typename T>
-const Future<T>& Future<T>::onFailed(const FailedCallback& callback) const
-{
- bool run = false;
-
- internal::acquire(&data->lock);
- {
- if (data->state == FAILED) {
- run = true;
- } else if (data->state == PENDING) {
- data->onFailedCallbacks.push_back(callback);
- }
- }
- internal::release(&data->lock);
-
- // TODO(*): Invoke callback in another execution context.
- if (run) {
- callback(*data->message);
- }
-
- return *this;
-}
-
-
-template <typename T>
-const Future<T>& Future<T>::onDiscarded(
- const DiscardedCallback& callback) const
-{
- bool run = false;
-
- internal::acquire(&data->lock);
- {
- if (data->state == DISCARDED) {
- run = true;
- } else if (data->state == PENDING) {
- data->onDiscardedCallbacks.push_back(callback);
- }
- }
- internal::release(&data->lock);
-
- // TODO(*): Invoke callback in another execution context.
- if (run) {
- callback();
- }
-
- return *this;
-}
-
-
-template <typename T>
-const Future<T>& Future<T>::onAny(const AnyCallback& callback) const
-{
- bool run = false;
-
- internal::acquire(&data->lock);
- {
- if (data->state == PENDING) {
- data->onAnyCallbacks.push_back(callback);
- } else {
- run = true;
- }
- }
- internal::release(&data->lock);
-
- // TODO(*): Invoke callback in another execution context.
- if (run) {
- callback(*this);
- }
-
- return *this;
-}
-#endif // __cplusplus >= 201103L
-
namespace internal {
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/include/process/timeseries.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/timeseries.hpp b/3rdparty/libprocess/include/process/timeseries.hpp
index dbb2c7a..ec0ac67 100644
--- a/3rdparty/libprocess/include/process/timeseries.hpp
+++ b/3rdparty/libprocess/include/process/timeseries.hpp
@@ -215,18 +215,8 @@ private:
index = 1;
}
-#if __cplusplus >= 201103L
next = values.erase(next);
next++; // Skip one element.
-#else
- // Store the next deletion candidate.
- typename std::map<Time, T>::iterator copy = next;
- copy++; // Skip every other element.
- copy++; // Next deletion candidate.
-
- values.erase(next);
- next = copy;
-#endif
index = index.get() + 1;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/src/io.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/io.cpp b/3rdparty/libprocess/src/io.cpp
index 3afa11a..1ec85e3 100644
--- a/3rdparty/libprocess/src/io.cpp
+++ b/3rdparty/libprocess/src/io.cpp
@@ -232,7 +232,6 @@ Future<size_t> write(int fd, void* data, size_t size)
namespace internal {
-#if __cplusplus >= 201103L
Future<string> _read(
int fd,
const memory::shared_ptr<string>& buffer,
@@ -248,45 +247,8 @@ Future<string> _read(
return _read(fd, buffer, data, length);
});
}
-#else
-// Forward declataion.
-Future<string> _read(
- int fd,
- const memory::shared_ptr<string>& buffer,
- const boost::shared_array<char>& data,
- size_t length);
-
-
-Future<string> __read(
- size_t size,
- int fd,
- const memory::shared_ptr<string>& buffer,
- const boost::shared_array<char>& data,
- size_t length)
-{
- if (size == 0) { // EOF.
- return string(*buffer);
- }
-
- buffer->append(data.get(), size);
-
- return _read(fd, buffer, data, length);
-}
-
-
-Future<string> _read(
- int fd,
- const memory::shared_ptr<string>& buffer,
- const boost::shared_array<char>& data,
- size_t length)
-{
- return io::read(fd, data.get(), length)
- .then(lambda::bind(&__read, lambda::_1, fd, buffer, data, length));
-}
-#endif // __cplusplus >= 201103L
-#if __cplusplus >= 201103L
Future<Nothing> _write(
int fd,
Owned<string> data,
@@ -300,39 +262,8 @@ Future<Nothing> _write(
return _write(fd, data, index + length);
});
}
-#else
-// Forward declaration.
-Future<Nothing> _write(
- int fd,
- Owned<string> data,
- size_t index);
-
-
-Future<Nothing> __write(
- int fd,
- Owned<string> data,
- size_t index,
- size_t length)
-{
- if (index + length == data->size()) {
- return Nothing();
- }
- return _write(fd, data, index + length);
-}
-
-
-Future<Nothing> _write(
- int fd,
- Owned<string> data,
- size_t index)
-{
- return io::write(fd, (void*) (data->data() + index), data->size() - index)
- .then(lambda::bind(&__write, fd, data, index, lambda::_1));
-}
-#endif // __cplusplus >= 201103L
-#if __cplusplus >= 201103L
void _splice(
int from,
int to,
@@ -378,93 +309,6 @@ void _splice(
.onFailed([=] (const string& message) { promise->fail(message); })
.onDiscarded([=] () { promise->discard(); });
}
-#else
-// Forward declarations.
-void __splice(
- int from,
- int to,
- size_t chunk,
- boost::shared_array<char> data,
- memory::shared_ptr<Promise<Nothing> > promise,
- size_t size);
-
-void ___splice(
- memory::shared_ptr<Promise<Nothing> > promise,
- const string& message);
-
-void ____splice(
- memory::shared_ptr<Promise<Nothing> > promise);
-
-
-void _splice(
- int from,
- int to,
- size_t chunk,
- boost::shared_array<char> data,
- memory::shared_ptr<Promise<Nothing> > promise)
-{
- // Stop splicing if a discard occured on our future.
- if (promise->future().hasDiscard()) {
- // TODO(benh): Consider returning the number of bytes already
- // spliced on discarded, or a failure. Same for the 'onDiscarded'
- // callbacks below.
- promise->discard();
- return;
- }
-
- Future<size_t> read = io::read(from, data.get(), chunk);
-
- // Stop reading (or potentially indefinitely polling) if a discard
- // occurs on our future.
- promise->future().onDiscard(
- lambda::bind(&process::internal::discard<size_t>,
- WeakFuture<size_t>(read)));
-
- read
- .onReady(
- lambda::bind(&__splice, from, to, chunk, data, promise, lambda::_1))
- .onFailed(lambda::bind(&___splice, promise, lambda::_1))
- .onDiscarded(lambda::bind(&____splice, promise));
-}
-
-
-void __splice(
- int from,
- int to,
- size_t chunk,
- boost::shared_array<char> data,
- memory::shared_ptr<Promise<Nothing> > promise,
- size_t size)
-{
- if (size == 0) { // EOF.
- promise->set(Nothing());
- } else {
- // Note that we always try and complete the write, even if a
- // discard has occured on our future, in order to provide
- // semantics where everything read is written. The promise will
- // eventually be discarded in the next read.
- io::write(to, string(data.get(), size))
- .onReady(lambda::bind(&_splice, from, to, chunk, data, promise))
- .onFailed(lambda::bind(&___splice, promise, lambda::_1))
- .onDiscarded(lambda::bind(&____splice, promise));
- }
-}
-
-
-void ___splice(
- memory::shared_ptr<Promise<Nothing> > promise,
- const string& message)
-{
- promise->fail(message);
-}
-
-
-void ____splice(
- memory::shared_ptr<Promise<Nothing> > promise)
-{
- promise->discard();
-}
-#endif // __cplusplus >= 201103L
Future<Nothing> splice(int from, int to, size_t chunk)
http://git-wip-us.apache.org/repos/asf/mesos/blob/5ab8ff81/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index eb38edc..7c2cb4b 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -711,26 +711,12 @@ TEST(Process, defer3)
volatile bool bool2 = false;
Deferred<void(bool)> set1 =
-#if __cplusplus >= 201103L
defer([&bool1] (bool b) { bool1 = b; });
-#else // __cplusplus >= 201103L
- defer(std::tr1::function<void(bool)>(
- std::tr1::bind(&set<volatile bool>,
- &bool1,
- std::tr1::placeholders::_1)));
-#endif // __cplusplus >= 201103L
set1(true);
Deferred<void(bool)> set2 =
-#if __cplusplus >= 201103L
defer([&bool2] (bool b) { bool2 = b; });
-#else // __cplusplus >= 201103L
- defer(std::tr1::function<void(bool)>(
- std::tr1::bind(&set<volatile bool>,
- &bool2,
- std::tr1::placeholders::_1)));
-#endif // __cplusplus >= 201103L
set2(true);
@@ -1686,7 +1672,6 @@ TEST(Process, provide)
}
-#if __cplusplus >= 201103L
int baz(string s) { return 42; }
Future<int> bam(string s) { return 42; }
@@ -1829,7 +1814,6 @@ TEST(Process, defers)
Future<int> future13 = Future<string>().then(
defer(functor));
}
-#endif // __cplusplus >= 201103L
TEST(Future, FromTry)