> On Jan. 27, 2015, 1:08 a.m., Ben Mahler wrote: > > 3rdparty/libprocess/include/process/limiter.hpp, lines 37-39 > > <https://reviews.apache.org/r/30192/diff/3/?file=835003#file835003line37> > > > > This is a bit confusing to me, couldn't you just say that "Discarding > > this future cancels the acquisition."? Then it's obvious that the cancelled > > acquisition has no effect, no need to spell it out?
sg. > On Jan. 27, 2015, 1:08 a.m., Ben Mahler wrote: > > 3rdparty/libprocess/include/process/limiter.hpp, line 85 > > <https://reviews.apache.org/r/30192/diff/3/?file=835003#file835003line85> > > > > Do you want to just pull it down to treat in block similarly? > > > > ``` > > if (!promises.empty()) { > > // Need to wait for others to get permits first. > > ... > > return ...; > > } > > > > if (timeout.remaining() > Seconds(0)) { > > // Need to wait a bit longer, but first one in the queue. > > ... > > return ...; > > } > > > > // No need to wait! > > ... > > return ...; > > ``` > > > > Or use else? > > > > ``` > > if (!promises.empty()) { > > // Need to wait for others to get permits first. > > ... > > return ...; > > } else if (timeout.remaining() > Seconds(0)) { > > // Need to wait a bit longer, but first one in the queue. > > ... > > return ...; > > } else { > > // No need to wait! > > ... > > return ...; > > } > > ... > > ``` > > > > First one seems a bit easier to read? done. - Vinod ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/30192/#review69714 ----------------------------------------------------------- On Jan. 27, 2015, 12:18 a.m., Vinod Kone wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/30192/ > ----------------------------------------------------------- > > (Updated Jan. 27, 2015, 12:18 a.m.) > > > Review request for mesos, Ben Mahler and Jie Yu. > > > Bugs: MESOS-2230 > https://issues.apache.org/jira/browse/MESOS-2230 > > > Repository: mesos-git > > > Description > ------- > > I tried/implemented a complex solution involving list iterators and removing > discarded promises from the list, but it was hard to reason about the > correctness and race conditions. So abandoned it in favor of a simpler > solution. Let me know what you think. > > > Diffs > ----- > > 3rdparty/libprocess/include/process/limiter.hpp > a1c4f189565003f19f8b33c3b8a81e28836069c1 > 3rdparty/libprocess/src/tests/limiter_tests.cpp PRE-CREATION > > Diff: https://reviews.apache.org/r/30192/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Vinod Kone > >