GRPC C 称为PloteimionQueue关闭,但PostemionQueue.Next在有待处理事件时永远阻

grpc c++ called CompletionQueue shutdown but CompletionQueue.next blocked forever when there is pending event

本文关键字:处理事件 时永 永远 Next PostemionQueue 称为 PloteimionQueue 关闭 GRPC      更新时间:2023-10-16

有两个线程,一个呼叫在完整形式上关闭

    debug_log("cq shutdown startn");
    cq.Shutdown();
    debug_log("cq shutdown successn");

在另一个theads中,cq.next永远被阻止。

我可以看到CQ中有一个悬而未决的事件,但是从文档中,我希望一旦调用关闭,cq.next将开始返回false。

我不知道这里怎么了。

这是CQ.Next

的调用堆栈
grpc_iocp_work(grpc_exec_ctx * exec_ctx, gpr_timespec deadline) Line 83 C
grpc_pollset_work(grpc_exec_ctx * exec_ctx, grpc_pollset * pollset, grpc_pollset_worker * * worker_hdl, gpr_timespec now, gpr_timespec deadline) Line 143   C
cq_next(grpc_completion_queue * cc, gpr_timespec deadline, void * reserved) Line 844    C
grpc_completion_queue_next(grpc_completion_queue * cc, gpr_timespec deadline, void * reserved) Line 873 C
grpc::CompletionQueue::AsyncNextInternal(void * * tag, bool * ok, gpr_timespec deadline) Line 71    C++
grpc::CompletionQueue::Next(void * * tag, bool * ok) Line 151   C++

API表示CQ.Next一旦您排干CQ,将返回false。我不确定您是否有一个待定事件的意思,但是如果不是关机事件,您的CQ.Next仍将等待该事件返回之前返回false(在下一个呼叫中)。