Hi

I meet the situation that the Next return true, but ok==false, howerer, the 
content of the tag is right, tag->status.ok() return true, tag->reply is 
right too, That confuse me,
why would this situation happen? Could I ignore the check of ok?

在 2017年8月2日星期三 UTC+8上午6:57:16,Yang Gao写道:
>
> Usually we have a loop calling Next and when we are sure there will be no 
> more work adding to the completion queue we call completion queue's 
> Shutdown method to shutdown the queue.
> It will in turn cause the Next to return false and it can be used to break 
> out of the loop.
>
> The ok parameter is an indication of the success of that particular 
> operation and usually is not related to the cq life time management. 
>
>
> On Monday, July 10, 2017 at 2:32:37 AM UTC-7, Przemysław Sobala wrote:
>>
>> Hello
>> What is the difference between method's
>> bool CompletionQueue::Next(void** tag, bool* ok)
>> return value and 2nd parameter's value?
>>
>> Reading docs, it says:
>> /// \param ok[out] true if read a regular event, false otherwise.
>> /// \return true if read a regular event, false if the queue is shutting 
>> down
>>
>> Following the example:
>> while (true) {
>>      // Block waiting to read the next event from the completion queue. 
>> The
>>      // event is uniquely identified by its tag, which in this case is 
>> the
>>      // memory address of a CallData instance.
>>      // The return value of Next should always be checked. This return 
>> value
>>      // tells us whether there is any kind of event or cq_ is shutting 
>> down.
>>      GPR_ASSERT(cq_->Next(&tag, &ok));
>>      GPR_ASSERT(ok);
>>      static_cast<CallData*>(tag)->Proceed();
>>    }
>> it breaks whether the return value or ok parameter is false.
>> But in the production environment maybe I can break the loop when the 
>> queue is shutting down (based on return value) and continue when ok 
>> parameter's value is false?
>> What is the most preferable approach? Should I consider both of them as 
>> the same and break on false as in the example?
>>
>> --
>> regards
>> Przemysław Sobala
>>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/35ece217-c182-4dd9-b779-bbe8bf6b58d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to