13 #ifndef __PROCESS_EXECUTOR_HPP__ 14 #define __PROCESS_EXECUTOR_HPP__ 72 typename std::enable_if<!std::is_void<R>::value,
int>
::type = 0>
74 -> decltype(
dispatch(process, std::function<R()>(std::forward<F>(
f))))
79 return dispatch(process, std::function<R()>(std::forward<F>(
f)));
87 typename std::enable_if<std::is_void<R>::value,
int>::type = 0>
98 [](
const std::function<R()>& f_) { f_();
return Nothing(); },
99 std::function<R()>(std::forward<F>(
f))));
108 #define __executor__ \ 109 (_executor_ == nullptr ? _executor_ = new Executor() : _executor_) 113 #endif // __PROCESS_EXECUTOR_HPP__ std::string generate(const std::string &prefix="")
Returns 'prefix(N)' where N represents the number of instances where the same prefix (wrt...
Definition: nothing.hpp:16
F && f
Definition: defer.hpp:270
Definition: process.hpp:72
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.
thread_local Executor * _executor_
Future< Nothing > execute(F &&f)
Definition: executor.hpp:88
_Deferred< F > defer(F &&f)
Definition: executor.hpp:54
void dispatch(const PID< T > &pid, void(T::*method)())
Definition: dispatch.hpp:174
auto execute(F &&f) -> decltype(dispatch(process, std::function< R()>(std::forward< F >(f))))
Definition: executor.hpp:73
Definition: deferred.hpp:64
bool wait(const UPID &pid, const Duration &duration=Seconds(-1))
Wait for the process to exit for no more than the specified seconds.
Executor()
Definition: executor.hpp:32
void stop()
Definition: executor.hpp:43
Definition: executor.hpp:48
Try< uint32_t > type(const std::string &path)
Try< Nothing > bind(int_fd s, const Address &address)
Definition: network.hpp:46
Definition: executor.hpp:29
~Executor()
Definition: executor.hpp:37