Description
A sequence is used to serialize a set of callbacks such that a callback won't be invoked until all previous registered callbacks are done. For example, consider the following callbacks in a process:
class TestProcess : public Process<TestProcess> {
public:
Future<int> foo()
Future<int> _foo()
{ return dispatch(self(), &Self::__foo); }Future<int> __foo()
{ return fooValue; }Future<int> bar()
{ return barValue; }}
A user may want foo and its continuations (_foo and __foo) to be executed atomically without interleaved with other callbacks like bar. To achieve that, with the sequence abstraction, one can just do the following:
Sequence sequence;
sequence.add(defer(procese, &TestProcess::foo));
sequence.add(defer(process, &TestProcess::bar));