Apache Mesos
Classes | Namespaces | Macros | Functions
run.hpp File Reference
#include <memory>
#include <process/id.hpp>
#include <process/process.hpp>
#include <stout/lambda.hpp>
#include <stout/preprocessor.hpp>

Go to the source code of this file.

Classes

class  process::internal::ThunkProcess< R >
 

Namespaces

 process
 
 process::internal
 

Macros

#define TEMPLATE(Z, N, DATA)
 

Functions

template<typename R >
Future< R > process::run (R(*method)())
 

Macro Definition Documentation

#define TEMPLATE (   Z,
  N,
  DATA 
)
Value:
template <typename R, \
ENUM_PARAMS(N, typename P), \
ENUM_PARAMS(N, typename A)> \
Future<R> run( \
R (*method)(ENUM_PARAMS(N, P)), \
ENUM_BINARY_PARAMS(N, A, a)) \
{ \
std::shared_ptr<lambda::function<R()>> thunk( \
new lambda::function<R()>( \
lambda::bind(method, ENUM_PARAMS(N, a)))); \
\
std::shared_ptr<Promise<R>> promise(new Promise<R>()); \
Future<R> future = promise->future(); \
terminate(spawn(new internal::ThunkProcess<R>(thunk, promise), true)); \
\
return future; \
}
UPID spawn(ProcessBase *process, bool manage=false)
Spawn a new process.
void terminate(const UPID &pid, bool inject=true)
Sends a TerminateEvent to the given process.
Protocol< PromiseRequest, PromiseResponse > promise
void run(std::vector< C > &&callbacks, Arguments &&...arguments)
Definition: future.hpp:617
#define ENUM_BINARY_PARAMS
Definition: preprocessor.hpp:36
Try< Nothing > bind(int_fd s, const Address &address)
Definition: network.hpp:46
#define ENUM_PARAMS
Definition: preprocessor.hpp:35