cq = static_cast<grpc_completion_queue*>(
gpr_zalloc(sizeof(grpc_completion_queue) + vtable->data_size +
poller_vtable->size()));
稍微解释下grpc_pollset_size:
size_t grpc_pollset_size(void) { return grpc_pollset_impl->pollset_size(); }
//ev_posix.cc
grpc_pollset_vtable grpc_posix_pollset_vtable = {
pollset_global_init, pollset_global_shutdown,
pollset_init, pollset_shutdown,
pollset_destroy, pollset_work,
pollset_kick, pollset_size};
static size_t pollset_size(void) { return g_event_engine->pollset_size; }
//ev_epollex_linux.cc
static const grpc_event_engine_vtable vtable = {
sizeof(grpc_pollset),//第一个
………………
先来看第一句:
poller_vtable->init(POLLSET_FROM_CQ(cq), &cq->mu);
再来看第二句
vtable->init(DATA_FROM_CQ(cq), shutdown_callback);
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。