You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Benjamin Hindman <be...@berkeley.edu> on 2017/08/30 06:30:47 UTC

Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/
-----------------------------------------------------------

Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.


Bugs: MESOS-7926
    https://issues.apache.org/jira/browse/MESOS-7926


Repository: mesos


Description
-------

This can be useful in circumstances where you don't want some
asynchronous operation to be canceled.


Diffs
-----

  3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
  3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 


Diff: https://reviews.apache.org/r/61987/diff/1/


Testing
-------

make check


Thanks,

Benjamin Hindman


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Michael Park <mp...@apache.org>.

> On Aug. 30, 2017, 5:14 p.m., Michael Park wrote:
> > 3rdparty/libprocess/include/process/future.hpp
> > Lines 1702-1703 (patched)
> > <https://reviews.apache.org/r/61987/diff/1/?file=1807590#file1807590line1702>
> >
> >     Let's stick to the `typename std::enable_if<condition, int>::type = 0` pattern for now.
> 
> Benjamin Hindman wrote:
>     How come? That's not what I've used other places ... what are the pros and cons of each approach?

The current approach doesn't allow you to SFINAE over an overload set.

For example,
```cpp
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
void f(T) { std::cout << "integral\n"; }

template <typename T, typename = typename std::enable_if<!std::is_integral<T>::value>::type>
void f(T) { std::cout << "!integral\n"; }

f(42);  // doesn't work -- "redefining a default template parameter"
```

vs

```cpp
template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
void f(T) { std::cout << "integral\n"; }

template <typename T, typename std::enable_if<!std::is_integral<T>::value, int>::type = 0>
void f(T) { std::cout << "!integral\n"; }

f(42);  // works
```

In other cases it doesn't make a difference, so I prefer to just use this
pattern rather than trying to identify / teach cases where this is necessary.


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184221
-----------------------------------------------------------


On Aug. 30, 2017, 9:42 p.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2017, 9:42 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/2/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184221
-----------------------------------------------------------




3rdparty/libprocess/include/process/future.hpp
Lines 1674 (patched)
<https://reviews.apache.org/r/61987/#comment260309>

    Should be `std::declval<F&>()`, since the call you're actually making is `f(std::forward<Args>(args)...);` below.



3rdparty/libprocess/include/process/future.hpp
Lines 1676 (patched)
<https://reviews.apache.org/r/61987/#comment260312>

    You can just do `decltype(f(std::forward<Args>(args)...))` here.



3rdparty/libprocess/include/process/future.hpp
Lines 1678 (patched)
<https://reviews.apache.org/r/61987/#comment260311>

    Do you only want to support functions that return a `Future` by value? if a function returns a `const Future<T>&`, this `static_assert` will fail.



3rdparty/libprocess/include/process/future.hpp
Lines 1702-1703 (patched)
<https://reviews.apache.org/r/61987/#comment260313>

    Let's stick to the `typename std::enable_if<condition, int>::type = 0` pattern for now.



3rdparty/libprocess/include/process/future.hpp
Lines 1703 (patched)
<https://reviews.apache.org/r/61987/#comment260307>

    You need `typename std::decay<F>::type` here.
    
    `F` can deduce to be a l-value reference, in which case `is_specialization_of` will always return `false`, based on the implementation of it I see in `traits.hpp`.



3rdparty/libprocess/include/process/future.hpp
Lines 1704 (patched)
<https://reviews.apache.org/r/61987/#comment260308>

    You probably want to return `UndiscardableDecorator<typename std::decay<F>::type>` here, unless you're expecting `UndiscardableDecorator` to only exist as a temporary object.


- Michael Park


On Aug. 29, 2017, 11:30 p.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 29, 2017, 11:30 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Mesos Reviewbot Windows <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184134
-----------------------------------------------------------



Bad patch!

Reviews applied: [61987]

Logs available here: http://104.210.40.105/logs/master/61987

- Mesos Reviewbot Windows


On Aug. 29, 2017, 11:30 p.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 29, 2017, 11:30 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Gilbert Song <so...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184325
-----------------------------------------------------------


Ship it!




Ship It!

- Gilbert Song


On Aug. 30, 2017, 9:42 p.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2017, 9:42 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/2/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Benjamin Hindman <be...@berkeley.edu>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/
-----------------------------------------------------------

(Updated Aug. 31, 2017, 4:42 a.m.)


Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.


Bugs: MESOS-7926
    https://issues.apache.org/jira/browse/MESOS-7926


Repository: mesos


Description
-------

This can be useful in circumstances where you don't want some
asynchronous operation to be canceled.


Diffs (updated)
-----

  3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
  3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 


Diff: https://reviews.apache.org/r/61987/diff/2/

Changes: https://reviews.apache.org/r/61987/diff/1-2/


Testing
-------

make check


Thanks,

Benjamin Hindman


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184223
-----------------------------------------------------------




3rdparty/libprocess/include/process/future.hpp
Lines 1669-1670 (patched)
<https://reviews.apache.org/r/61987/#comment260314>

    You'll also need to constrain this to `is_constructible<F, G>`. Otherwise you're gonna be stealing the arguments that are supposed to go to the copy ctor.
    
    Pretty sure this is the compilation error Jie's running into on his machine.


- Michael Park


On Aug. 29, 2017, 11:30 p.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 29, 2017, 11:30 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184180
-----------------------------------------------------------


Ship it!




This LGTM! Probably ask mpark to take a second look on the decroator stuff which i am not super familiar with.

- Jie Yu


On Aug. 30, 2017, 6:30 a.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2017, 6:30 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Jie Yu <yu...@gmail.com>.

> On Aug. 30, 2017, 7:35 p.m., Jie Yu wrote:
> > I got this compile error on my box:
> > ```[jie@core-dev build]$ gcc -v
> > Using built-in specs.
> > COLLECT_GCC=/usr/bin/gcc
> > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
> > Target: x86_64-redhat-linux
> > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
> > Thread model: posix
> > gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) 
> > [jie@core-dev build]$ uname -a
> > Linux core-dev 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
> > 
> > 
> > 
> > In file included from /home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:18:0:
> > /home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp: In instantiation of ‘process::UndiscardableDecorator<F>::UndiscardableDecorator(G&&) [with G = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>&; F = FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43]’:
> > /usr/include/c++/4.8.2/functional:1910:34:   required from ‘static void std::_Function_base::_Base_manager<_Functor>::_M_clone(std::_Any_data&, const std::_Any_data&, std::false_type) [with _Functor = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>; std::false_type = std::integral_constant<bool, false>]’
> > /usr/include/c++/4.8.2/functional:1946:51:   required from ‘static bool std::_Function_base::_Base_manager<_Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Functor = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>]’
> > /usr/include/c++/4.8.2/functional:2460:19:   required from ‘std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = process::UndiscardableDecorator<FutureTest_Und
> > iscardableLambda_Test::TestBody()::__lambda43>; <template-parameter-2-2> = void; _Res = process::Future<int>; _ArgTypes = {const int&}]’
> > /home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:385:16:   required from ‘process::Future<X> process::Future<T>::then(F&&, process::Future<T>::Prefer) con
> > st [with F = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>; X = int; T = int]’
> > /home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:417:45:   required from ‘decltype (this->.then(forward<F>(f), process::Future<T>::Prefer())) process::Fut
> > ure<T>::then(F&&) const [with F = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>; T = int; decltype (this->.then(forward<F>(f), proc
> > ess::Future<T>::Prefer())) = <type error>]’
> > /home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:578:7:   required from here
> > /home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:1670:55: error: no matching function for call to ‘FutureTest_UndiscardableLambda_Test::TestBody()::__lamb
> > da43::__lambda43(process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>&)’
> >    UndiscardableDecorator(G&& g) : f(std::forward<G>(g)) {}
> >                                                        ^
> > /home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:1670:55: note: candidates are:
> > /home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note: constexpr FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43::<lambda>(const Futur
> > eTest_UndiscardableLambda_Test::TestBody()::__lambda43&)
> >      .then(undiscardable([&](int multiplier) {
> >                            ^
> > /home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note:   no known conversion for argument 1 from ‘process::UndiscardableDecorator<FutureTest_Undis
> > cardableLambda_Test::TestBody()::__lambda43>’ to ‘const FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43&’
> > /home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note: constexpr FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43::<lambda>(FutureTest_
> > UndiscardableLambda_Test::TestBody()::__lambda43&&)
> > /home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note:   no known conversion for argument 1 from ‘process::UndiscardableDecorator<FutureTest_Undis
> > cardableLambda_Test::TestBody()::__lambda43>’ to ‘FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43&&’```

@benh, can we split this into two patches. Let's commit the non lambda version first to unblock MESOS-7926?


- Jie


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184185
-----------------------------------------------------------


On Aug. 30, 2017, 6:30 a.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2017, 6:30 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184185
-----------------------------------------------------------



I got this compile error on my box:
```[jie@core-dev build]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) 
[jie@core-dev build]$ uname -a
Linux core-dev 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux



In file included from /home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:18:0:
/home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp: In instantiation of ‘process::UndiscardableDecorator<F>::UndiscardableDecorator(G&&) [with G = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>&; F = FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43]’:
/usr/include/c++/4.8.2/functional:1910:34:   required from ‘static void std::_Function_base::_Base_manager<_Functor>::_M_clone(std::_Any_data&, const std::_Any_data&, std::false_type) [with _Functor = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>; std::false_type = std::integral_constant<bool, false>]’
/usr/include/c++/4.8.2/functional:1946:51:   required from ‘static bool std::_Function_base::_Base_manager<_Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Functor = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>]’
/usr/include/c++/4.8.2/functional:2460:19:   required from ‘std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = process::UndiscardableDecorator<FutureTest_Und
iscardableLambda_Test::TestBody()::__lambda43>; <template-parameter-2-2> = void; _Res = process::Future<int>; _ArgTypes = {const int&}]’
/home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:385:16:   required from ‘process::Future<X> process::Future<T>::then(F&&, process::Future<T>::Prefer) con
st [with F = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>; X = int; T = int]’
/home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:417:45:   required from ‘decltype (this->.then(forward<F>(f), process::Future<T>::Prefer())) process::Fut
ure<T>::then(F&&) const [with F = process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>; T = int; decltype (this->.then(forward<F>(f), proc
ess::Future<T>::Prefer())) = <type error>]’
/home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:578:7:   required from here
/home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:1670:55: error: no matching function for call to ‘FutureTest_UndiscardableLambda_Test::TestBody()::__lamb
da43::__lambda43(process::UndiscardableDecorator<FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43>&)’
   UndiscardableDecorator(G&& g) : f(std::forward<G>(g)) {}
                                                       ^
/home/jie/workspace/mesos/3rdparty/libprocess/include/process/future.hpp:1670:55: note: candidates are:
/home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note: constexpr FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43::<lambda>(const Futur
eTest_UndiscardableLambda_Test::TestBody()::__lambda43&)
     .then(undiscardable([&](int multiplier) {
                           ^
/home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note:   no known conversion for argument 1 from ‘process::UndiscardableDecorator<FutureTest_Undis
cardableLambda_Test::TestBody()::__lambda43>’ to ‘const FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43&’
/home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note: constexpr FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43::<lambda>(FutureTest_
UndiscardableLambda_Test::TestBody()::__lambda43&&)
/home/jie/workspace/mesos/3rdparty/libprocess/src/tests/future_tests.cpp:573:27: note:   no known conversion for argument 1 from ‘process::UndiscardableDecorator<FutureTest_Undis
cardableLambda_Test::TestBody()::__lambda43>’ to ‘FutureTest_UndiscardableLambda_Test::TestBody()::__lambda43&&’```

- Jie Yu


On Aug. 30, 2017, 6:30 a.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2017, 6:30 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Jie Yu <yu...@gmail.com>.

> On Aug. 30, 2017, 3:21 p.m., Jie Yu wrote:
> > 3rdparty/libprocess/include/process/future.hpp
> > Lines 1695-1696 (patched)
> > <https://reviews.apache.org/r/61987/diff/1/?file=1807590#file1807590line1695>
> >
> >     IIUC, in this example, `undiscardable([]() { ...; })` lambda won't even be called until the future returned by `foo()` is in a terminal state. In that case, if there is a discard on `future`, the `thenf` callback will set `future` to DISCARDED without calling `undiscardable([]() { ...; })`.
> >     
> >     Sounds like wither the lambda `[]() { ...; }` has `undiscardable` or not doesn't matter?

ah, I think it'll be useful when someone discard `future` when the future returned by `foo()` is already in a terminal state.


- Jie


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184154
-----------------------------------------------------------


On Aug. 30, 2017, 6:30 a.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2017, 6:30 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Re: Review Request 61987: Added an undiscardable() helper that blocks discards from propagating.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61987/#review184154
-----------------------------------------------------------




3rdparty/libprocess/include/process/future.hpp
Lines 1695-1696 (patched)
<https://reviews.apache.org/r/61987/#comment260206>

    IIUC, in this example, `undiscardable([]() { ...; })` lambda won't even be called until the future returned by `foo()` is in a terminal state. In that case, if there is a discard on `future`, the `thenf` callback will set `future` to DISCARDED without calling `undiscardable([]() { ...; })`.
    
    Sounds like wither the lambda `[]() { ...; }` has `undiscardable` or not doesn't matter?


- Jie Yu


On Aug. 30, 2017, 6:30 a.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61987/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2017, 6:30 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-7926
>     https://issues.apache.org/jira/browse/MESOS-7926
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This can be useful in circumstances where you don't want some
> asynchronous operation to be canceled.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 2f5f0a20b5a39b04fd684b1cb44b6a33b647bbef 
>   3rdparty/libprocess/src/tests/future_tests.cpp 0c8725b9a5e64aaac6e3979e450a11e84f9bd45e 
> 
> 
> Diff: https://reviews.apache.org/r/61987/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>