Jie Yu created MESOS-956:
----------------------------

             Summary: Add an "Sequence" abstraction to serialize callbacks.
                 Key: MESOS-956
                 URL: https://issues.apache.org/jira/browse/MESOS-956
             Project: Mesos
          Issue Type: Improvement
          Components: c++ api
            Reporter: Jie Yu
            Assignee: Jie Yu
             Fix For: 0.18.0


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() { return dispatch(self(), &Self::_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));



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to