Thank You

On Thursday, October 31, 2019 at 10:58:07 AM UTC+5:30, Acorn Pooley wrote:
>
> My understanding is that AsyncNotifyWhenDone is useful if you want to be 
> notified that the request was cancelled (either explicitly cancelled by the 
> caller or implicitly cancelled because the connection was dropped).  When 
> you see the AsyncNotifyWhenDone you can check IsCancelled to see if the rpc 
> got cancelled.  But you also get the AsyncNotifyWhenDone after the rpc is 
> finished.  I'm not sure about the order of the Finish and Done events - I'm 
> not sure it is  guaranteed they always come in the same order.  If you 
> delete the "this" pointer in either event then you have to be careful not 
> to also delete it (or otherwise dereference it) in the other event.  I deal 
> with this by using a "tag" that is not actually a pointer - I use an index 
> into an array of currently executing rpcs plus some "salt" bits that make 
> each tag unique.
>
> If you don't care if the rpc gets cancelled then I don't think there is 
> much use for the AsyncNotifyWhenDone AFAICT.
>
> Cheers,
> Acorn
>
> On Wednesday, October 30, 2019 at 3:58:57 AM UTC-7, Debashish Deka wrote:
>>
>> In the greeter example provided in the GitHub repo, we see this line: (
>> https://github.com/grpc/grpc/blob/v1.24.0/examples/cpp/helloworld/greeter_async_server.cc
>> )
>>
>> responder_.Finish(reply_, Status::OK, this);
>>
>> Because of the "this" pointer argument, cq_.Next() triggers the event and 
>> we clear the CallData object inside in the "FINISH" state as per the 
>> example provided.
>>
>> I tried to use "*AsyncNotifyWhenDone*" just before RequestsayHello():
>>
>> ctx_.*AsyncNotifyWhenDone*((void*)(*extFunction*)) where *extFunction *is 
>> some random function declared in the file. I found that, cq_.Next() 
>> triggered a new event with tag value equal to the extFunction address. 
>>
>> So, we get two events now, one because of the Finish call and the other 
>> due to the AsyncNotifyWhenDone() call. I want to ask, what could be a use 
>> of using AsyncNotifyWhenDone
>> ? I could not find any special requirements apart from deleting the 
>> CallData instance.
>>
>> If I am wrong in part of the question. Please correct me.
>> Thank you! 
>>  
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/87b93e8e-20a6-4928-9295-1512b782c8af%40googlegroups.com.

Reply via email to