13 #ifndef __PROCESS_RUN_HPP__ 14 #define __PROCESS_RUN_HPP__ 43 promise->set((*thunk)());
47 std::shared_ptr<lambda::function<R()>> thunk;
48 std::shared_ptr<Promise<R>> promise;
57 std::shared_ptr<lambda::function<R()>> thunk(
58 new lambda::function<R()>(
61 std::shared_ptr<Promise<R>> promise(
new Promise<R>());
70 #define TEMPLATE(Z, N, DATA) \ 71 template <typename R, \ 72 ENUM_PARAMS(N, typename P), \ 73 ENUM_PARAMS(N, typename A)> \ 75 R (*method)(ENUM_PARAMS(N, P)), \ 76 ENUM_BINARY_PARAMS(N, A, a)) \ 78 std::shared_ptr<lambda::function<R()>> thunk( \ 79 new lambda::function<R()>( \ 80 lambda::bind(method, ENUM_PARAMS(N, a)))); \ 82 std::shared_ptr<Promise<R>> promise(new Promise<R>()); \ 83 Future<R> future = promise->future(); \ 85 terminate(spawn(new internal::ThunkProcess<R>(thunk, promise), true)); \ 95 #endif // __PROCESS_RUN_HPP__ std::string generate(const std::string &prefix="")
Returns 'prefix(N)' where N represents the number of instances where the same prefix (wrt...
REPEAT_FROM_TO(1, 13, TEMPLATE, _) class AsyncExecutorProcess
Definition: async.hpp:63
Definition: process.hpp:72
#define TEMPLATE(Z, N, DATA)
Definition: run.hpp:70
void serve(Event &&event) override
Invoked when an event is serviced.
Definition: run.hpp:41
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.
void run(std::vector< C > &&callbacks, Arguments &&...arguments)
Definition: future.hpp:621
Definition: attributes.hpp:24
Definition: executor.hpp:48
~ThunkProcess() override
Definition: run.hpp:38
Try< Nothing > bind(int_fd s, const Address &address)
Definition: network.hpp:46
ThunkProcess(std::shared_ptr< lambda::function< R()>> _thunk, std::shared_ptr< Promise< R >> _promise)
Definition: run.hpp:32
Definition: process.hpp:505