mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1363924 - /incubator/mesos/trunk/third_party/libprocess/include/process/collect.hpp
Date Fri, 20 Jul 2012 20:05:15 GMT
Author: benh
Date: Fri Jul 20 20:05:14 2012
New Revision: 1363924

URL: http://svn.apache.org/viewvc?rev=1363924&view=rev
Log:
Fixed two bugs (a memory leak and a race condition) in
process::collect (contributed by Jie Yu,
https://reviews.apache.org/r/5845).

Modified:
    incubator/mesos/trunk/third_party/libprocess/include/process/collect.hpp

Modified: incubator/mesos/trunk/third_party/libprocess/include/process/collect.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/libprocess/include/process/collect.hpp?rev=1363924&r1=1363923&r2=1363924&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/libprocess/include/process/collect.hpp (original)
+++ incubator/mesos/trunk/third_party/libprocess/include/process/collect.hpp Fri Jul 20 20:05:14
2012
@@ -77,8 +77,10 @@ private:
   {
     if (future.isFailed()) {
       promise->fail("Collect failed: " + future.failure());
+      terminate(this);
     } else if (future.isDiscarded()) {
       promise->fail("Collect failed: future discarded");
+      terminate(this);
     } else {
       assert(future.isReady());
       values.push_back(future.get());
@@ -104,8 +106,9 @@ inline Future<std::list<T> > collect(
     const Option<Timeout>& timeout)
 {
   Promise<std::list<T> >* promise = new Promise<std::list<T> >();
+  Future<std::list<T> > future = promise->future();
   spawn(new internal::CollectProcess<T>(futures, timeout, promise), true);
-  return promise->future();
+  return future;
 }
 
 } // namespace process {



Mime
View raw message