You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/01/14 21:04:57 UTC
[06/15] git commit: Replaced 'std::tr1' with 'lambda' and 'memory' in
libprocess.
Replaced 'std::tr1' with 'lambda' and 'memory' in libprocess.
Some fixes and enhancements were also made to the C++11 version of the
library. At this point libprocess can be compiled for C++11 and all
tests pass with gcc 4.8.
Review: https://reviews.apache.org/r/16655
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/89eec058
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/89eec058
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/89eec058
Branch: refs/heads/master
Commit: 89eec0581f954c26b0c37557cdf7b5266955e1a4
Parents: 7f16f83
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sun Dec 29 22:10:36 2013 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Tue Jan 14 12:00:38 2014 -0800
----------------------------------------------------------------------
3rdparty/libprocess/include/process/async.hpp | 52 +--
.../libprocess/include/process/c++11/defer.hpp | 256 ++++++++++++
.../include/process/c++11/deferred.hpp | 256 ++++++++++++
.../libprocess/include/process/c++11/delay.hpp | 87 ++++
.../include/process/c++11/dispatch.hpp | 398 +++++++++++++++++++
.../include/process/c++11/executor.hpp | 68 ++++
3rdparty/libprocess/include/process/collect.hpp | 7 +-
3rdparty/libprocess/include/process/defer.hpp | 4 +
.../libprocess/include/process/deferred.hpp | 4 +
3rdparty/libprocess/include/process/delay.hpp | 66 +--
.../libprocess/include/process/dispatch.hpp | 201 +++++-----
3rdparty/libprocess/include/process/event.hpp | 10 +-
.../libprocess/include/process/executor.hpp | 4 +
3rdparty/libprocess/include/process/future.hpp | 186 +++++----
3rdparty/libprocess/include/process/gmock.hpp | 7 +-
3rdparty/libprocess/include/process/process.hpp | 20 +-
.../libprocess/include/process/protobuf.hpp | 6 +-
3rdparty/libprocess/include/process/run.hpp | 28 +-
3rdparty/libprocess/include/process/timer.hpp | 9 +-
3rdparty/libprocess/src/process.cpp | 29 +-
3rdparty/libprocess/src/tests/process_tests.cpp | 48 ++-
3rdparty/libprocess/src/timer.cpp | 9 +-
22 files changed, 1433 insertions(+), 322 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/3rdparty/libprocess/include/process/async.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/async.hpp b/3rdparty/libprocess/include/process/async.hpp
index 8fa2771..a7ac0cb 100644
--- a/3rdparty/libprocess/include/process/async.hpp
+++ b/3rdparty/libprocess/include/process/async.hpp
@@ -6,7 +6,7 @@
#include <process/id.hpp>
#include <process/process.hpp>
-#include <tr1/functional>
+#include <stout/lambda.hpp>
namespace process {
@@ -26,7 +26,7 @@ private:
AsyncExecutorProcess& operator = (const AsyncExecutorProcess&);
template<typename F>
- typename std::tr1::result_of<F(void)>::type execute(
+ typename lambda::result_of<F(void)>::type execute(
const F& f)
{
terminate(self()); // Terminate this process after the function returns.
@@ -35,7 +35,7 @@ private:
// TODO(vinod): Use boost macro enumerations.
template<typename F, typename A1>
- typename std::tr1::result_of<F(A1)>::type execute(
+ typename lambda::result_of<F(A1)>::type execute(
const F& f, A1 a1)
{
terminate(self()); // Terminate this process after the function returns.
@@ -43,7 +43,7 @@ private:
}
template<typename F, typename A1, typename A2>
- typename std::tr1::result_of<F(A1, A2)>::type execute(
+ typename lambda::result_of<F(A1, A2)>::type execute(
const F& f, A1 a1, A2 a2)
{
terminate(self()); // Terminate this process after the function returns.
@@ -51,7 +51,7 @@ private:
}
template<typename F, typename A1, typename A2, typename A3>
- typename std::tr1::result_of<F(A1, A2, A3)>::type execute(
+ typename lambda::result_of<F(A1, A2, A3)>::type execute(
const F& f, A1 a1, A2 a2, A3 a3)
{
terminate(self()); // Terminate this process after the function returns.
@@ -59,7 +59,7 @@ private:
}
template<typename F, typename A1, typename A2, typename A3, typename A4>
- typename std::tr1::result_of<F(A1, A2, A3, A4)>::type execute(
+ typename lambda::result_of<F(A1, A2, A3, A4)>::type execute(
const F& f, A1 a1, A2 a2, A3 a3, A4 a4)
{
terminate(self()); // Terminate this process after the function returns.
@@ -74,23 +74,23 @@ class AsyncExecutor
private:
// Declare async functions as friends.
template<typename F>
- friend Future<typename std::tr1::result_of<F(void)>::type> async(
+ friend Future<typename lambda::result_of<F(void)>::type> async(
const F& f);
template<typename F, typename A1>
- friend Future<typename std::tr1::result_of<F(A1)>::type> async(
+ friend Future<typename lambda::result_of<F(A1)>::type> async(
const F& f, A1 a1);
template<typename F, typename A1, typename A2>
- friend Future<typename std::tr1::result_of<F(A1, A2)>::type> async(
+ friend Future<typename lambda::result_of<F(A1, A2)>::type> async(
const F& f, A1 a1, A2 a2);
template<typename F, typename A1, typename A2, typename A3>
- friend Future<typename std::tr1::result_of<F(A1, A2, A3)>::type> async(
+ friend Future<typename lambda::result_of<F(A1, A2, A3)>::type> async(
const F& f, A1 a1, A2 a2, A3 a3);
template<typename F, typename A1, typename A2, typename A3, typename A4>
- friend Future<typename std::tr1::result_of<F(A1, A2, A3, A4)>::type> async(
+ friend Future<typename lambda::result_of<F(A1, A2, A3, A4)>::type> async(
const F& f, A1 a1, A2 a2, A3 a3, A4 a4);
AsyncExecutor()
@@ -106,11 +106,11 @@ private:
AsyncExecutor& operator = (const AsyncExecutor&);
template<typename F>
- Future<typename std::tr1::result_of<F(void)>::type> execute(
+ Future<typename lambda::result_of<F(void)>::type> execute(
const F& f)
{
// Necessary to disambiguate.
- typedef typename std::tr1::result_of<F(void)>::type
+ typedef typename lambda::result_of<F(void)>::type
(AsyncExecutorProcess::*R)(const F&);
return dispatch(process,
@@ -120,11 +120,11 @@ private:
// TODO(vinod): Use boost macro enumerations.
template<typename F, typename A1>
- Future<typename std::tr1::result_of<F(A1)>::type> execute(
+ Future<typename lambda::result_of<F(A1)>::type> execute(
const F& f, A1 a1)
{
// Necessary to disambiguate.
- typedef typename std::tr1::result_of<F(A1)>::type
+ typedef typename lambda::result_of<F(A1)>::type
(AsyncExecutorProcess::*R)(const F&, A1);
return dispatch(process,
@@ -134,11 +134,11 @@ private:
}
template<typename F, typename A1, typename A2>
- Future<typename std::tr1::result_of<F(A1, A2)>::type> execute(
+ Future<typename lambda::result_of<F(A1, A2)>::type> execute(
const F& f, A1 a1, A2 a2)
{
// Necessary to disambiguate.
- typedef typename std::tr1::result_of<F(A1, A2)>::type
+ typedef typename lambda::result_of<F(A1, A2)>::type
(AsyncExecutorProcess::*R)(const F&, A1, A2);
return dispatch(process,
@@ -149,11 +149,11 @@ private:
}
template<typename F, typename A1, typename A2, typename A3>
- Future<typename std::tr1::result_of<F(A1, A2, A3)>::type> execute(
+ Future<typename lambda::result_of<F(A1, A2, A3)>::type> execute(
const F& f, A1 a1, A2 a2, A3 a3)
{
// Necessary to disambiguate.
- typedef typename std::tr1::result_of<F(A1, A2, A3)>::type
+ typedef typename lambda::result_of<F(A1, A2, A3)>::type
(AsyncExecutorProcess::*R)(const F&, A1, A2, A3);
return dispatch(process,
@@ -165,11 +165,11 @@ private:
}
template<typename F, typename A1, typename A2, typename A3, typename A4>
- Future<typename std::tr1::result_of<F(A1, A2, A3, A4)>::type> execute(
+ Future<typename lambda::result_of<F(A1, A2, A3, A4)>::type> execute(
const F& f, A1 a1, A2 a2, A3 a3, A4 a4)
{
// Necessary to disambiguate.
- typedef typename std::tr1::result_of<F(A1, A2, A3, A4)>::type
+ typedef typename lambda::result_of<F(A1, A2, A3, A4)>::type
(AsyncExecutorProcess::*R)(const F&, A1, A2, A3, A4);
return dispatch(process,
@@ -188,7 +188,7 @@ private:
// Provides an abstraction for asynchronously executing a function.
// TODO(vinod): Use boost macro to enumerate arguments/params.
template<typename F>
-Future<typename std::tr1::result_of<F(void)>::type>
+Future<typename lambda::result_of<F(void)>::type>
async(const F& f)
{
return AsyncExecutor().execute(f);
@@ -196,7 +196,7 @@ Future<typename std::tr1::result_of<F(void)>::type>
template<typename F, typename A1>
-Future<typename std::tr1::result_of<F(A1)>::type>
+Future<typename lambda::result_of<F(A1)>::type>
async(const F& f, A1 a1)
{
return AsyncExecutor().execute(f, a1);
@@ -204,7 +204,7 @@ Future<typename std::tr1::result_of<F(A1)>::type>
template<typename F, typename A1, typename A2>
-Future<typename std::tr1::result_of<F(A1, A2)>::type>
+Future<typename lambda::result_of<F(A1, A2)>::type>
async(const F& f, A1 a1, A2 a2)
{
return AsyncExecutor().execute(f, a1, a2);
@@ -212,7 +212,7 @@ Future<typename std::tr1::result_of<F(A1, A2)>::type>
template<typename F, typename A1, typename A2, typename A3>
-Future<typename std::tr1::result_of<F(A1, A2, A3)>::type>
+Future<typename lambda::result_of<F(A1, A2, A3)>::type>
async(const F& f, A1 a1, A2 a2, A3 a3)
{
return AsyncExecutor().execute(f, a1, a2, a3);
@@ -220,7 +220,7 @@ Future<typename std::tr1::result_of<F(A1, A2, A3)>::type>
template<typename F, typename A1, typename A2, typename A3, typename A4>
-Future<typename std::tr1::result_of<F(A1, A2, A3, A4)>::type>
+Future<typename lambda::result_of<F(A1, A2, A3, A4)>::type>
async(const F& f, A1 a1, A2 a2, A3 a3, A4 a4)
{
return AsyncExecutor().execute(f, a1, a2, a3, a4);
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/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
new file mode 100644
index 0000000..27b0643
--- /dev/null
+++ b/3rdparty/libprocess/include/process/c++11/defer.hpp
@@ -0,0 +1,256 @@
+#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.
+#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))>(), ENUM_PARAMS(N, a)))> \
+ { \
+ return std::bind(std::function<void(ENUM_PARAMS(N, P))>( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ dispatch(pid, method, ENUM_PARAMS(N, p)); \
+ }), 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)); \
+ } \
+ \
+ 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))>(), ENUM_PARAMS(N, a)))> \
+ { \
+ return std::bind(std::function<Future<R>(ENUM_PARAMS(N, P))>( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ return dispatch(pid, method, ENUM_PARAMS(N, p)); \
+ }), 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)); \
+ } \
+ \
+ 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))>(), ENUM_PARAMS(N, a)))> \
+ { \
+ return std::bind(std::function<Future<R>(ENUM_PARAMS(N, P))>( \
+ [=] (ENUM_BINARY_PARAMS(N, P, p)) { \
+ return dispatch(pid, method, ENUM_PARAMS(N, p)); \
+ }), 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)); \
+ } \
+ \
+ 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, f);
+}
+
+
+template <typename F>
+_Deferred<F> defer(F f)
+{
+ if (__process__ != NULL) {
+ return defer(__process__->self(), f);
+ }
+
+ return __executor__->defer(f);
+}
+
+} // namespace process {
+
+#endif // __PROCESS_DEFER_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/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
new file mode 100644
index 0000000..06e67cf
--- /dev/null
+++ b/3rdparty/libprocess/include/process/c++11/deferred.hpp
@@ -0,0 +1,256 @@
+#ifndef __PROCESS_DEFERRED_HPP__
+#define __PROCESS_DEFERRED_HPP__
+
+#include <functional>
+
+#include <process/dispatch.hpp>
+#include <process/future.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 G> struct _Deferred;
+
+
+// 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));
+
+ Deferred(const std::function<F>& f) : std::function<F>(f) {}
+};
+
+
+template <typename F>
+struct _Deferred
+{
+ operator Deferred<void()> () const
+ {
+ 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_));
+ });
+ }
+
+#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);
+
+ template <typename G>
+ friend _Deferred<G> defer(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))>(), ENUM_PARAMS(N, a)))>;
+
+ 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))>(), ENUM_PARAMS(N, a)))>;
+
+ 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))>(), ENUM_PARAMS(N, a)))>;
+
+ REPEAT_FROM_TO(1, 11, TEMPLATE, _) // Args A0 -> A9.
+#undef TEMPLATE
+
+ _Deferred(UPID pid, F f) : pid(pid), f(f) {}
+ _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/89eec058/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
new file mode 100644
index 0000000..5f686db
--- /dev/null
+++ b/3rdparty/libprocess/include/process/c++11/delay.hpp
@@ -0,0 +1,87 @@
+#ifndef __PROCESS_DELAY_HPP__
+#define __PROCESS_DELAY_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 Timer::create(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 Timer::create(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/89eec058/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
new file mode 100644
index 0000000..76da282
--- /dev/null
+++ b/3rdparty/libprocess/include/process/c++11/dispatch.hpp
@@ -0,0 +1,398 @@
+#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 std::string& method = std::string());
+
+
+// Canonicalizes a pointer to a member function (i.e., method) into a
+// bytes representation for comparison (e.g., in tests).
+template <typename Method>
+std::string canonicalize(Method method)
+{
+ return std::string(reinterpret_cast<const char*>(&method), sizeof(method));
+}
+
+} // 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, internal::canonicalize(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, internal::canonicalize(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, internal::canonicalize(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, internal::canonicalize(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, internal::canonicalize(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, internal::canonicalize(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/89eec058/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
new file mode 100644
index 0000000..c6c9032
--- /dev/null
+++ b/3rdparty/libprocess/include/process/c++11/executor.hpp
@@ -0,0 +1,68 @@
+#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(), 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/89eec058/3rdparty/libprocess/include/process/collect.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/collect.hpp b/3rdparty/libprocess/include/process/collect.hpp
index 27e2729..ff8ab34 100644
--- a/3rdparty/libprocess/include/process/collect.hpp
+++ b/3rdparty/libprocess/include/process/collect.hpp
@@ -11,6 +11,7 @@
#include <process/process.hpp>
#include <process/timeout.hpp>
+#include <stout/lambda.hpp>
#include <stout/none.hpp>
#include <stout/option.hpp>
@@ -69,8 +70,7 @@ public:
typename std::list<Future<T> >::const_iterator iterator;
for (iterator = futures.begin(); iterator != futures.end(); ++iterator) {
- (*iterator).onAny(
- defer(this, &CollectProcess::waited, std::tr1::placeholders::_1));
+ (*iterator).onAny(defer(this, &CollectProcess::waited, lambda::_1));
}
}
@@ -153,8 +153,7 @@ public:
typename std::list<Future<T> >::const_iterator iterator;
for (iterator = futures.begin(); iterator != futures.end(); ++iterator) {
- (*iterator).onAny(
- defer(this, &AwaitProcess::waited, std::tr1::placeholders::_1));
+ (*iterator).onAny(defer(this, &AwaitProcess::waited, lambda::_1));
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/3rdparty/libprocess/include/process/defer.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/defer.hpp b/3rdparty/libprocess/include/process/defer.hpp
index 1eb770b..dc2ec3b 100644
--- a/3rdparty/libprocess/include/process/defer.hpp
+++ b/3rdparty/libprocess/include/process/defer.hpp
@@ -1,3 +1,6 @@
+#if __cplusplus >= 201103L
+#include <process/c++11/defer.hpp>
+#else
#ifndef __PROCESS_DEFER_HPP__
#define __PROCESS_DEFER_HPP__
@@ -436,3 +439,4 @@ inline Deferred<void(void)> defer(const std::tr1::function<void(void)>& f)
} // namespace process {
#endif // __PROCESS_DEFER_HPP__
+#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/3rdparty/libprocess/include/process/deferred.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/deferred.hpp b/3rdparty/libprocess/include/process/deferred.hpp
index 8907e80..a25080f 100644
--- a/3rdparty/libprocess/include/process/deferred.hpp
+++ b/3rdparty/libprocess/include/process/deferred.hpp
@@ -1,3 +1,6 @@
+#if __cplusplus >= 201103L
+#include <process/c++11/deferred.hpp>
+#else
#ifndef __PROCESS_DEFERRED_HPP__
#define __PROCESS_DEFERRED_HPP__
@@ -134,3 +137,4 @@ private:
} // namespace process {
#endif // __PROCESS_DEFERRED_HPP__
+#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/3rdparty/libprocess/include/process/delay.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/delay.hpp b/3rdparty/libprocess/include/process/delay.hpp
index 97acd76..487f652 100644
--- a/3rdparty/libprocess/include/process/delay.hpp
+++ b/3rdparty/libprocess/include/process/delay.hpp
@@ -1,12 +1,15 @@
+#if __cplusplus >= 201103L
+#include <process/c++11/delay.hpp>
+#else
#ifndef __PROCESS_DELAY_HPP__
#define __PROCESS_DELAY_HPP__
-#include <tr1/functional>
-
#include <process/dispatch.hpp>
#include <process/timer.hpp>
#include <stout/duration.hpp>
+#include <stout/lambda.hpp>
+#include <stout/memory.hpp>
#include <stout/preprocessor.hpp>
namespace process {
@@ -21,21 +24,21 @@ Timer delay(const Duration& duration,
const PID<T>& pid,
void (T::*method)())
{
- std::tr1::shared_ptr<std::tr1::function<void(T*)> > thunk(
- new std::tr1::function<void(T*)>(
- std::tr1::bind(method, std::tr1::placeholders::_1)));
-
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher(
- new std::tr1::function<void(ProcessBase*)>(
- std::tr1::bind(&internal::vdispatcher<T>,
- std::tr1::placeholders::_1,
- thunk)));
-
- std::tr1::function<void(void)> dispatch =
- std::tr1::bind(internal::dispatch,
- pid,
- dispatcher,
- internal::canonicalize(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,
+ internal::canonicalize(method));
return Timer::create(duration, dispatch);
}
@@ -68,23 +71,21 @@ Timer delay(const Duration& duration,
void (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- std::tr1::shared_ptr<std::tr1::function<void(T*)> > thunk( \
- new std::tr1::function<void(T*)>( \
- std::tr1::bind(method, \
- std::tr1::placeholders::_1, \
- ENUM_PARAMS(N, a)))); \
+ memory::shared_ptr<lambda::function<void(T*)> > thunk( \
+ new lambda::function<void(T*)>( \
+ lambda::bind(method, lambda::_1, ENUM_PARAMS(N, a)))); \
\
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher( \
- new std::tr1::function<void(ProcessBase*)>( \
- std::tr1::bind(&internal::vdispatcher<T>, \
- std::tr1::placeholders::_1, \
- thunk))); \
+ memory::shared_ptr<lambda::function<void(ProcessBase*)> > dispatcher( \
+ new lambda::function<void(ProcessBase*)>( \
+ lambda::bind(&internal::vdispatcher<T>, \
+ lambda::_1, \
+ thunk))); \
\
- std::tr1::function<void(void)> dispatch = \
- std::tr1::bind(internal::dispatch, \
- pid, \
- dispatcher, \
- internal::canonicalize(method)); \
+ lambda::function<void(void)> dispatch = \
+ lambda::bind(internal::dispatch, \
+ pid, \
+ dispatcher, \
+ internal::canonicalize(method)); \
\
return Timer::create(duration, dispatch); \
} \
@@ -117,3 +118,4 @@ Timer delay(const Duration& duration,
} // namespace process {
#endif // __PROCESS_DELAY_HPP__
+#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/3rdparty/libprocess/include/process/dispatch.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/dispatch.hpp b/3rdparty/libprocess/include/process/dispatch.hpp
index b337a87..88570f7 100644
--- a/3rdparty/libprocess/include/process/dispatch.hpp
+++ b/3rdparty/libprocess/include/process/dispatch.hpp
@@ -1,13 +1,15 @@
+#if __cplusplus >= 201103L
+#include <process/c++11/dispatch.hpp>
+#else
#ifndef __PROCESS_DISPATCH_HPP__
#define __PROCESS_DISPATCH_HPP__
#include <string>
-#include <tr1/functional>
-#include <tr1/memory> // TODO(benh): Replace all 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 {
@@ -51,7 +53,7 @@ namespace internal {
// will probably change in the future to unique_ptr (or a variant).
void dispatch(
const UPID& pid,
- const std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> >& f,
+ const memory::shared_ptr<lambda::function<void(ProcessBase*)> >& f,
const std::string& method = std::string());
// For each return type (void, future, value) there is a dispatcher
@@ -65,7 +67,7 @@ void dispatch(
template <typename T>
void vdispatcher(
ProcessBase* process,
- std::tr1::shared_ptr<std::tr1::function<void(T*)> > thunk)
+ memory::shared_ptr<lambda::function<void(T*)> > thunk)
{
assert(process != NULL);
T* t = dynamic_cast<T*>(process);
@@ -77,8 +79,8 @@ void vdispatcher(
template <typename R, typename T>
void pdispatcher(
ProcessBase* process,
- std::tr1::shared_ptr<std::tr1::function<Future<R>(T*)> > thunk,
- std::tr1::shared_ptr<Promise<R> > promise)
+ memory::shared_ptr<lambda::function<Future<R>(T*)> > thunk,
+ memory::shared_ptr<Promise<R> > promise)
{
assert(process != NULL);
T* t = dynamic_cast<T*>(process);
@@ -90,8 +92,8 @@ void pdispatcher(
template <typename R, typename T>
void rdispatcher(
ProcessBase* process,
- std::tr1::shared_ptr<std::tr1::function<R(T*)> > thunk,
- std::tr1::shared_ptr<Promise<R> > promise)
+ memory::shared_ptr<lambda::function<R(T*)> > thunk,
+ memory::shared_ptr<Promise<R> > promise)
{
assert(process != NULL);
T* t = dynamic_cast<T*>(process);
@@ -125,17 +127,17 @@ std::string canonicalize(Method method)
// void (T::*method)(P...),
// P... p)
// {
-// std::tr1::shared_ptr<std::tr1::function<void(T*)> > thunk(
-// new std::tr1::function<void(T*)>(
-// std::tr1::bind(method,
-// std::tr1::placeholders::_1,
-// std::forward<P>(p)...)));
+// memory::shared_ptr<lambda::function<void(T*)> > thunk(
+// new lambda::function<void(T*)>(
+// lambda::bind(method,
+// lambda::_1,
+// std::forward<P>(p)...)));
//
-// std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher(
-// new std::tr1::function<void(ProcessBase*)>(
-// std::tr1::bind(&internal::vdispatcher<T>,
-// std::tr1::placeholders::_1,
-// thunk)));
+// 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, internal::canonicalize(method));
// }
@@ -145,15 +147,15 @@ void dispatch(
const PID<T>& pid,
void (T::*method)(void))
{
- std::tr1::shared_ptr<std::tr1::function<void(T*)> > thunk(
- new std::tr1::function<void(T*)>(
- std::tr1::bind(method, std::tr1::placeholders::_1)));
+ memory::shared_ptr<lambda::function<void(T*)> > thunk(
+ new lambda::function<void(T*)>(
+ lambda::bind(method, lambda::_1)));
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher(
- new std::tr1::function<void(ProcessBase*)>(
- std::tr1::bind(&internal::vdispatcher<T>,
- std::tr1::placeholders::_1,
- thunk)));
+ 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, internal::canonicalize(method));
}
@@ -183,17 +185,17 @@ void dispatch(
void (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- std::tr1::shared_ptr<std::tr1::function<void(T*)> > thunk( \
- new std::tr1::function<void(T*)>( \
- std::tr1::bind(method, \
- std::tr1::placeholders::_1, \
- ENUM_PARAMS(N, a)))); \
+ memory::shared_ptr<lambda::function<void(T*)> > thunk( \
+ new lambda::function<void(T*)>( \
+ lambda::bind(method, \
+ lambda::_1, \
+ ENUM_PARAMS(N, a)))); \
\
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher( \
- new std::tr1::function<void(ProcessBase*)>( \
- std::tr1::bind(&internal::vdispatcher<T>, \
- std::tr1::placeholders::_1, \
- thunk))); \
+ 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, internal::canonicalize(method)); \
} \
@@ -232,20 +234,20 @@ void dispatch(
// Future<R> (T::*method)(P...),
// P... p)
// {
-// std::tr1::shared_ptr<std::tr1::function<Future<R>(T*)> > thunk(
-// new std::tr1::function<Future<R>(T*)>(
-// std::tr1::bind(method,
-// std::tr1::placeholders::_1,
-// std::forward<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)...)));
//
-// std::tr1::shared_ptr<Promise<R> > promise(new Promise<R>());
+// memory::shared_ptr<Promise<R> > promise(new Promise<R>());
// Future<R> future = promise->future();
//
-// std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher(
-// new std::tr1::function<void(ProcessBase*)>(
-// std::tr1::bind(&internal::pdispatcher<R, T>,
-// std::tr1::placeholders::_1,
-// thunk, promise)));
+// 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, internal::canonicalize(method));
//
@@ -257,18 +259,18 @@ Future<R> dispatch(
const PID<T>& pid,
Future<R> (T::*method)(void))
{
- std::tr1::shared_ptr<std::tr1::function<Future<R>(T*)> > thunk(
- new std::tr1::function<Future<R>(T*)>(
- std::tr1::bind(method, std::tr1::placeholders::_1)));
+ memory::shared_ptr<lambda::function<Future<R>(T*)> > thunk(
+ new lambda::function<Future<R>(T*)>(
+ lambda::bind(method, lambda::_1)));
- std::tr1::shared_ptr<Promise<R> > promise(new Promise<R>());
+ memory::shared_ptr<Promise<R> > promise(new Promise<R>());
Future<R> future = promise->future();
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher(
- new std::tr1::function<void(ProcessBase*)>(
- std::tr1::bind(&internal::pdispatcher<R, T>,
- std::tr1::placeholders::_1,
- thunk, promise)));
+ 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, internal::canonicalize(method));
@@ -301,20 +303,20 @@ Future<R> dispatch(
Future<R> (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- std::tr1::shared_ptr<std::tr1::function<Future<R>(T*)> > thunk( \
- new std::tr1::function<Future<R>(T*)>( \
- std::tr1::bind(method, \
- std::tr1::placeholders::_1, \
- ENUM_PARAMS(N, 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::tr1::shared_ptr<Promise<R> > promise(new Promise<R>()); \
+ memory::shared_ptr<Promise<R> > promise(new Promise<R>()); \
Future<R> future = promise->future(); \
\
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher( \
- new std::tr1::function<void(ProcessBase*)>( \
- std::tr1::bind(&internal::pdispatcher<R, T>, \
- std::tr1::placeholders::_1, \
- thunk, promise))); \
+ 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, internal::canonicalize(method)); \
\
@@ -357,20 +359,20 @@ Future<R> dispatch(
// R (T::*method)(P...),
// P... p)
// {
-// std::tr1::shared_ptr<std::tr1::function<R(T*)> > thunk(
-// new std::tr1::function<R(T*)>(
-// std::tr1::bind(method,
-// std::tr1::placeholders::_1,
-// std::forward<P>(p)...)));
+// memory::shared_ptr<lambda::function<R(T*)> > thunk(
+// new lambda::function<R(T*)>(
+// lambda::bind(method,
+// lambda::_1,
+// std::forward<P>(p)...)));
//
-// std::tr1::shared_ptr<Promise<R> > promise(new Promise<R>());
+// memory::shared_ptr<Promise<R> > promise(new Promise<R>());
// Future<R> future = promise->future();
//
-// std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher(
-// new std::tr1::function<void(ProcessBase*)>(
-// std::tr1::bind(&internal::rdispatcher<R, T>,
-// std::tr1::placeholders::_1,
-// thunk, promise)));
+// 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, internal::canonicalize(method));
//
@@ -382,18 +384,18 @@ Future<R> dispatch(
const PID<T>& pid,
R (T::*method)(void))
{
- std::tr1::shared_ptr<std::tr1::function<R(T*)> > thunk(
- new std::tr1::function<R(T*)>(
- std::tr1::bind(method, std::tr1::placeholders::_1)));
+ memory::shared_ptr<lambda::function<R(T*)> > thunk(
+ new lambda::function<R(T*)>(
+ lambda::bind(method, lambda::_1)));
- std::tr1::shared_ptr<Promise<R> > promise(new Promise<R>());
+ memory::shared_ptr<Promise<R> > promise(new Promise<R>());
Future<R> future = promise->future();
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher(
- new std::tr1::function<void(ProcessBase*)>(
- std::tr1::bind(&internal::rdispatcher<R, T>,
- std::tr1::placeholders::_1,
- thunk, promise)));
+ 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, internal::canonicalize(method));
@@ -426,20 +428,20 @@ Future<R> dispatch(
R (T::*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
- std::tr1::shared_ptr<std::tr1::function<R(T*)> > thunk( \
- new std::tr1::function<R(T*)>( \
- std::tr1::bind(method, \
- std::tr1::placeholders::_1, \
- ENUM_PARAMS(N, a)))); \
+ memory::shared_ptr<lambda::function<R(T*)> > thunk( \
+ new lambda::function<R(T*)>( \
+ lambda::bind(method, \
+ lambda::_1, \
+ ENUM_PARAMS(N, a)))); \
\
- std::tr1::shared_ptr<Promise<R> > promise(new Promise<R>()); \
+ memory::shared_ptr<Promise<R> > promise(new Promise<R>()); \
Future<R> future = promise->future(); \
\
- std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > dispatcher( \
- new std::tr1::function<void(ProcessBase*)>( \
- std::tr1::bind(&internal::rdispatcher<R, T>, \
- std::tr1::placeholders::_1, \
- thunk, promise))); \
+ 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, internal::canonicalize(method)); \
\
@@ -476,3 +478,4 @@ Future<R> dispatch(
} // namespace process {
#endif // __PROCESS_DISPATCH_HPP__
+#endif // __cplusplus >= 201103L
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/3rdparty/libprocess/include/process/event.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/event.hpp b/3rdparty/libprocess/include/process/event.hpp
index cf728da..ca407ec 100644
--- a/3rdparty/libprocess/include/process/event.hpp
+++ b/3rdparty/libprocess/include/process/event.hpp
@@ -1,14 +1,14 @@
#ifndef __PROCESS_EVENT_HPP__
#define __PROCESS_EVENT_HPP__
-#include <tr1/functional>
-#include <tr1/memory> // TODO(benh): Replace all shared_ptr with unique_ptr.
-
#include <process/future.hpp>
#include <process/http.hpp>
#include <process/message.hpp>
#include <process/socket.hpp>
+#include <stout/lambda.hpp>
+#include <stout/memory.hpp> // TODO(benh): Replace shared_ptr with unique_ptr.
+
namespace process {
// Forward declarations.
@@ -124,7 +124,7 @@ struct DispatchEvent : Event
{
DispatchEvent(
const UPID& _pid,
- const std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> >& _f,
+ const memory::shared_ptr<lambda::function<void(ProcessBase*)> >& _f,
const std::string& _method)
: pid(_pid),
f(_f),
@@ -140,7 +140,7 @@ struct DispatchEvent : Event
const UPID pid;
// Function to get invoked as a result of this dispatch event.
- const std::tr1::shared_ptr<std::tr1::function<void(ProcessBase*)> > f;
+ const memory::shared_ptr<lambda::function<void(ProcessBase*)> > f;
// Canonical "byte" representation of a pointer to a member function
// (i.e., method) encapsulated in the above function (or empty if
http://git-wip-us.apache.org/repos/asf/mesos/blob/89eec058/3rdparty/libprocess/include/process/executor.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/executor.hpp b/3rdparty/libprocess/include/process/executor.hpp
index f203476..4ce0a21 100644
--- a/3rdparty/libprocess/include/process/executor.hpp
+++ b/3rdparty/libprocess/include/process/executor.hpp
@@ -1,3 +1,6 @@
+#if __cplusplus >= 201103L
+#include <process/c++11/executor.hpp>
+#else
#ifndef __PROCESS_EXECUTOR_HPP__
#define __PROCESS_EXECUTOR_HPP__
@@ -258,3 +261,4 @@ extern ThreadLocal<Executor>* _executor_;
} // namespace process {
#endif // __PROCESS_EXECUTOR_HPP__
+#endif // __cplusplus >= 201103L