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


Patch looks great!

Reviews applied: [35395]

All tests passed.

- Mesos ReviewBot


On June 12, 2015, 5:06 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/35395/
> -----------------------------------------------------------
> 
> (Updated June 12, 2015, 5:06 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> (1) Simplify introducing new synchronization primitives.
> 
> Before:
> 
> ```cpp
> template <>
> class Synchronized<bufferevent>
> {
> public:
>   Synchronized(bufferevent* _bev) : bev(CHECK_NOTNULL(_bev))
>   {
>     bufferevent_lock(bev);
>   }
>   
>   Synchronized(bufferevent** _bev) : Synchronized(*CHECK_NOTNULL(_bev)) {}
>   
>   ~Synchronized()
>   {
>     bufferevent_unlock(bev);
>   }
>   
>   operator bool() const { return true; }
> 
> private:
>   bufferevent* bev;
> };
> ```
> 
> After:
> 
> ```cpp
> Synchronized<bufferevent> synchronize(bufferevent* bev) {
>   return {
>     bev,
>     [](bufferevent* bev) { bufferevent_lock(bev); }
>     [](bufferevent* bev) { bufferevent_unlock(bev); }
>   };
> }
> ```
> 
> (2) Enable `return` within `synchronized` and avoid the `control reaches end 
> of non-void function` warning.
> 
> ```cpp
> int foo()
> {
>   int x = 42;
>   std::mutex m;
>   synchronized (m) {
>     return x;
>   }
> }
> ```
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/synchronized.hpp 
> 60eaf263f220b4990aefe4e5d6d2aa1296891e57 
> 
> Diff: https://reviews.apache.org/r/35395/diff/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Michael Park
> 
>

Reply via email to