I commented on https://reviews.apache.org/r/40501/ which I assume is the motivating review. Can you guys please follow up on fixing the approach there? FWICT, this can follow the exact approach taken here:
https://github.com/apache/mesos/blob/0.26.0-rc3/3rdparty/libprocess/src/tests/http_tests.cpp#L64-L117 On Thu, Dec 3, 2015 at 7:27 PM, Benjamin Mahler <[email protected]> wrote: > -1 > > This is asymmetric, the caller should be spawning and terminating, but we > terminate also within process destructors? This looks like compensating for > a programming error, needs more thought. > > I will revert this, and please revert any code that is using this pattern. > > On Thu, Dec 3, 2015 at 6:12 AM, <[email protected]> wrote: > >> Repository: mesos >> Updated Branches: >> refs/heads/master c73c06fec -> 47fe84b66 >> >> >> Added documentation about terminate/wait in Processes destructors. >> >> Based on a discussion here: >> https://reviews.apache.org/r/40501/#review107290 >> >> Review: https://reviews.apache.org/r/40557 >> >> >> Project: http://git-wip-us.apache.org/repos/asf/mesos/repo >> Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/47fe84b6 >> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/47fe84b6 >> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/47fe84b6 >> >> Branch: refs/heads/master >> Commit: 47fe84b666968c5cb18bac15b52e5bee1f347884 >> Parents: c73c06f >> Author: Joseph Wu <[email protected]> >> Authored: Thu Dec 3 15:09:22 2015 +0100 >> Committer: Bernd Mathiske <[email protected]> >> Committed: Thu Dec 3 15:09:22 2015 +0100 >> >> ---------------------------------------------------------------------- >> 3rdparty/libprocess/README.md | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> ---------------------------------------------------------------------- >> >> >> >> http://git-wip-us.apache.org/repos/asf/mesos/blob/47fe84b6/3rdparty/libprocess/README.md >> ---------------------------------------------------------------------- >> diff --git a/3rdparty/libprocess/README.md b/3rdparty/libprocess/README.md >> index c3f309a..281bda6 100644 >> --- a/3rdparty/libprocess/README.md >> +++ b/3rdparty/libprocess/README.md >> @@ -134,6 +134,20 @@ int main(int argc, char** argv) >> ~~~ >> ----> >> >> +> NOTE: In most cases, a process should have a destructor that terminates >> +> and waits on the process to finish. The process does not automatically >> +> terminate when the `Process` is deallocated. i.e.: >> + >> +~~~{.cpp} >> +class MyProcess : public Process<MyProcess> { >> + virtual ~MyProcess() >> + { >> + terminate(this); >> + wait(this); >> + } >> +}; >> +~~~ >> + >> --- >> >> ## Futures and Promises >> >> >
