> On May 11, 2015, 10:19 p.m., Ben Mahler wrote:
> > src/slave/slave.cpp, line 155
> > <https://reviews.apache.org/r/34016/diff/1/?file=954524#file954524line155>
> >
> >     unique_ptr is not a POD, so this will still try to run the destructor 
> > of the function during exit of the program.
> >     
> >     Can you just use a raw pointer here and leak it? (Not ideal but we use 
> > this in many places)
> 
> haosdent huang wrote:
>     Yes, I use raw pointer before. But got this error
>     ```
>     ../../src/slave/slave.cpp:519:19: error: cannot convert 
> ‘process::_Deferred<std::_Bind<std::_Mem_fn<void (std::function<void(int, 
> int)>::*)(int, int)const>(std::function<void(int, int)>, 
> std::_Placeholder<1>, std::_Placeholder<2>)> >’ to ‘std::function<void(int, 
> int)>*’ in assignment   signaledWrapper = defer(self(), &Slave::signaled, 
> lambda::_1, lambda::_2);
>     ```
>     So I use unique_ptr. Let me remove unique_ptr and add force convert here.
> 
> haosdent huang wrote:
>     But still have this error.
>     ```
>     ../../src/slave/slave.cpp:520:55: error: taking address of temporary 
> [-fpermissive]
>            self(), &Slave::signaled, lambda::_1, lambda::_2);
>                                                            ^
>     ```
>     So I use `new` here?
> 
> Ben Mahler wrote:
>     yes, you need a copy on the heap, so `new function<...>(defer(...));` 
> should work

But this heap object would never release util Slave exit, is it OK?


- haosdent


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


On May 12, 2015, 1:26 a.m., haosdent huang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/34016/
> -----------------------------------------------------------
> 
> (Updated May 12, 2015, 1:26 a.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Change the type of signaledWrapper to unique_ptr
> 
> 
> Diffs
> -----
> 
>   src/slave/slave.cpp bf290bfd7d9a59ce7197ce34cbd8cf42e7dd17a3 
> 
> Diff: https://reviews.apache.org/r/34016/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> haosdent huang
> 
>

Reply via email to