Apache Mesos
Classes | Namespaces | Macros | Functions
async.hpp File Reference
#include <type_traits>
#include <process/dispatch.hpp>
#include <process/future.hpp>
#include <process/id.hpp>
#include <process/pid.hpp>
#include <process/process.hpp>
#include <stout/lambda.hpp>
#include <stout/nothing.hpp>
#include <stout/preprocessor.hpp>
#include <stout/result_of.hpp>

Go to the source code of this file.

Classes

class  process::AsyncExecutor
 

Namespaces

 process
 

Macros

#define TEMPLATE(Z, N, DATA)
 
#define TEMPLATE(Z, N, DATA)
 
#define TEMPLATE(Z, N, DATA)
 
#define TEMPLATE(Z, N, DATA)
 
#define TEMPLATE(Z, N, DATA)
 

Functions

template<typename F >
Future< typename result_of< F()>::type > process::async (const F &f, typename std::enable_if<!std::is_void< typename result_of< F()>::type >::value >::type *=nullptr)
 
template<typename F >
Future< Nothingprocess::async (const F &f, typename std::enable_if< std::is_void< typename result_of< F()>::type >::value >::type *=nullptr)
 
 process::REPEAT_FROM_TO (1, 13, TEMPLATE, _) class AsyncExecutorProcess
 

Macro Definition Documentation

#define TEMPLATE (   Z,
  N,
  DATA 
)
Value:
template <typename F, ENUM_PARAMS(N, typename A)> \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<!std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type* = nullptr); /* NOLINT(whitespace/line_length) */ \
\
\
template <typename F, ENUM_PARAMS(N, typename A)> \
Future<Nothing> async( \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type* = nullptr);
F && f
Definition: defer.hpp:270
Future< Nothing > async(const F &f, typename std::enable_if< std::is_void< typename result_of< F()>::type >::value >::type *=nullptr)
Definition: async.hpp:247
#define ENUM_BINARY_PARAMS
Definition: preprocessor.hpp:36
Try< uint32_t > type(const std::string &path)
#define ENUM_PARAMS
Definition: preprocessor.hpp:35
#define TEMPLATE (   Z,
  N,
  DATA 
)
Value:
template < \
typename F, \
ENUM_PARAMS(N, typename A), \
typename std::enable_if< \
!std::is_void< \
int>::type = 0> \
const F& f, ENUM_BINARY_PARAMS(N, A, a)) \
{ \
terminate(self()); /* Terminate process after function returns. */ \
return f(ENUM_PARAMS(N, a)); \
} \
\
template < \
typename F, \
ENUM_PARAMS(N, typename A), \
typename std::enable_if< \
std::is_void< \
int>::type = 0> \
Nothing execute( \
const F& f, ENUM_BINARY_PARAMS(N, A, a)) \
{ \
terminate(self()); /* Terminate process after function returns. */ \
f(ENUM_PARAMS(N, a)); \
return Nothing(); \
}
Definition: nothing.hpp:16
void execute(const std::string &script)
F && f
Definition: defer.hpp:270
void terminate(const UPID &pid, bool inject=true)
Sends a TerminateEvent to the given process.
#define ENUM_BINARY_PARAMS
Definition: preprocessor.hpp:36
Try< uint32_t > type(const std::string &path)
#define ENUM_PARAMS
Definition: preprocessor.hpp:35
#define TEMPLATE (   Z,
  N,
  DATA 
)
Value:
template <typename F, ENUM_PARAMS(N, typename A)> \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<!std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type*); /* NOLINT(whitespace/line_length) */ \
\
template <typename F, ENUM_PARAMS(N, typename A)> \
friend Future<Nothing> async( \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type*);
F && f
Definition: defer.hpp:270
Future< Nothing > async(const F &f, typename std::enable_if< std::is_void< typename result_of< F()>::type >::value >::type *=nullptr)
Definition: async.hpp:247
#define ENUM_BINARY_PARAMS
Definition: preprocessor.hpp:36
Try< uint32_t > type(const std::string &path)
#define ENUM_PARAMS
Definition: preprocessor.hpp:35
#define TEMPLATE (   Z,
  N,
  DATA 
)
Value:
template <typename F, ENUM_PARAMS(N, typename A)> \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<!std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type* = nullptr) /* NOLINT(whitespace/line_length) */ \
{ \
/* Need to disambiguate overloaded method. */ \
typename result_of<F(ENUM_PARAMS(N, A))>::type(AsyncExecutorProcess::*method)(const F&, ENUM_PARAMS(N, A)) = /* NOLINT(whitespace/line_length) */ \
\
return dispatch(process, method, f, ENUM_PARAMS(N, a)); \
} \
\
template <typename F, ENUM_PARAMS(N, typename A)> \
Future<Nothing> execute( \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type* = nullptr) /* NOLINT(whitespace/line_length) */ \
{ \
/* Need to disambiguate overloaded method. */ \
Nothing(AsyncExecutorProcess::*method)(const F&, ENUM_PARAMS(N, A)) = \
\
return dispatch(process, method, f, ENUM_PARAMS(N, a)); \
}
void execute(const std::string &script)
F && f
Definition: defer.hpp:270
void dispatch(const UPID &pid, std::unique_ptr< lambda::CallableOnce< void(ProcessBase *)>> f, const Option< const std::type_info * > &functionType=None())
Definition: executor.hpp:48
#define ENUM_BINARY_PARAMS
Definition: preprocessor.hpp:36
Try< uint32_t > type(const std::string &path)
#define ENUM_PARAMS
Definition: preprocessor.hpp:35
#define TEMPLATE (   Z,
  N,
  DATA 
)
Value:
template <typename F, ENUM_PARAMS(N, typename A)> \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<!std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type*) /* NOLINT(whitespace/line_length) */ \
{ \
return AsyncExecutor().execute(f, ENUM_PARAMS(N, a)); \
} \
\
template <typename F, ENUM_PARAMS(N, typename A)> \
Future<Nothing> async( \
const F& f, \
ENUM_BINARY_PARAMS(N, A, a), \
typename std::enable_if<std::is_void<typename result_of<F(ENUM_PARAMS(N, A))>::type>::value>::type*) /* NOLINT(whitespace/line_length) */ \
{ \
return AsyncExecutor().execute(f, ENUM_PARAMS(N, a)); \
}
F && f
Definition: defer.hpp:270
Future< Nothing > async(const F &f, typename std::enable_if< std::is_void< typename result_of< F()>::type >::value >::type *=nullptr)
Definition: async.hpp:247
#define ENUM_BINARY_PARAMS
Definition: preprocessor.hpp:36
Try< uint32_t > type(const std::string &path)
#define ENUM_PARAMS
Definition: preprocessor.hpp:35