13 #ifndef __PROCESS_SEQUENCE_HPP__ 14 #define __PROCESS_SEQUENCE_HPP__ 16 #include <glog/logging.h> 29 class SequenceProcess;
36 Sequence(
const std::string&
id =
"sequence");
104 promise->future().onAny(
lambda::bind(&completed, notifier));
109 last.onAny(
lambda::bind(¬ified<T>, promise, callback));
125 notifier->future().onDiscard(
127 &internal::discard<T>,
131 notifier->future().onDiscard(
133 &internal::discard<Nothing>,
137 last = notifier->future();
139 return promise->future();
159 template <
typename T>
160 static void notified(
162 const lambda::function<
Future<T>()>& callback)
164 if (
promise->future().hasDiscard()) {
170 promise->associate(callback());
197 template <
typename T>
205 #endif // __PROCESS_SEQUENCE_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
Definition: sequence.hpp:63
Future< T > add(const lambda::function< Future< T >()> &callback)
Definition: sequence.hpp:71
Future< T > add(const lambda::function< Future< T >()> &callback)
Definition: sequence.hpp:198
Definition: process.hpp:72
~Sequence()
Definition: sequence.hpp:185
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.
Definition: sequence.hpp:33
void dispatch(const PID< T > &pid, void(T::*method)())
Definition: dispatch.hpp:174
Protocol< PromiseRequest, PromiseResponse > promise
Definition: future.hpp:79
bool wait(const UPID &pid, const Duration &duration=Seconds(-1))
Wait for the process to exit for no more than the specified seconds.
Definition: executor.hpp:48
SequenceProcess(const std::string &id)
Definition: sequence.hpp:66
void finalize() override
Invoked when a process is terminated.
Definition: sequence.hpp:143
Try< Nothing > bind(int_fd s, const Address &address)
Definition: network.hpp:46
Definition: process.hpp:505
Sequence(const std::string &id="sequence")
Definition: sequence.hpp:178
Definition: future.hpp:58