> On July 26, 2017, 10:49 p.m., Jie Yu wrote: > > 3rdparty/libprocess/include/process/grpc.hpp > > Lines 123 (patched) > > <https://reviews.apache.org/r/61097/diff/2/?file=1782280#file1782280line123> > > > > who is going to delete the lambda function?
This lambda will be retrieved and managed by a `shared_ptr` in `client::Runtime::Data::loop()`. When it will be deleted depends on if the call is successful. If so, the `shared_ptr` will be captured by another lambda that is dispatched to `client::Runtime::process`, and thus this lambda will be deleted after execution; otherwise, this lambda will be deleted at the end of the lifecycle of the `shared_ptr`. It is required that a `CompletionQueue` must be drained before getting destructed, so a regular termination process would call `CompletionQueue::Shutdown()` which makes `CompletionQueue::Next()` to return pending calls as failures in `client::Runtime::Data::loop()`, thus all allocated lambdas will eventually be deleted. - Chun-Hung ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/61097/#review181469 ----------------------------------------------------------- On July 25, 2017, 9:13 p.m., Chun-Hung Hsiao wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/61097/ > ----------------------------------------------------------- > > (Updated July 25, 2017, 9:13 p.m.) > > > Review request for mesos, Benjamin Mahler, Jie Yu, and Joseph Wu. > > > Bugs: MESOS-7810 > https://issues.apache.org/jira/browse/MESOS-7810 > > > Repository: mesos > > > Description > ------- > > A gRPC client can use `process::grpc::call(...)` to send an asynchronous > gRPC call and get a future for the response. The client needs to set up > two data structures: a `Channel` which represents a connection to a gRPC > server, and a `ClientRuntime` which maintains a `CompletionQueue` that > keeps track of all pending asynchronous gRPC calls, and spawns a thread > waiting for any response from the `CompletionQueue`. All gRPC calls > using the same `ClientRuntime` would share the same thread. > > > Diffs > ----- > > 3rdparty/libprocess/include/process/grpc.hpp PRE-CREATION > 3rdparty/libprocess/src/grpc.cpp PRE-CREATION > > > Diff: https://reviews.apache.org/r/61097/diff/2/ > > > Testing > ------- > > N/A > > > Thanks, > > Chun-Hung Hsiao > >
