From df5e9a578d7c4570167ab2202c63678c59e7ec38 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 24 Jun 2022 09:20:53 -0700 Subject: [PATCH] review feedback --- src/core/lib/iomgr/ev_epoll1_linux.cc | 54 +++++++++++++++++++-------- src/core/lib/iomgr/ev_poll_posix.cc | 7 ++-- src/core/lib/iomgr/ev_posix.cc | 1 + 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 190570fcb17..800c0832ed9 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -1304,11 +1304,11 @@ const grpc_event_engine_vtable grpc_ev_epoll1_posix = { pollset_set_del_fd, is_any_background_poller_thread, - "epoll1", - [](bool) { return init_epoll1_linux(); }, - []() {}, + /* name = */ "epoll1", + /* check_engine_available = */ [](bool) { return init_epoll1_linux(); }, + /* init_engine = */ []() {}, shutdown_background_closure, - []() {}, + /* shutdown_engine = */ []() {}, add_closure_to_background_poller, }; @@ -1360,22 +1360,44 @@ static bool init_epoll1_linux() { #if defined(GRPC_POSIX_SOCKET_EV_EPOLL1) #include "src/core/lib/iomgr/ev_epoll1_linux.h" const grpc_event_engine_vtable grpc_ev_epoll1_posix = { - 1, true, false, + 1, + true, + false, - nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, - nullptr, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, - nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, - nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, - nullptr, nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, - nullptr, "epoll1", [](bool) { return false; }, - nullptr, nullptr, nullptr, + nullptr, + /* name = */ "epoll1", + /* check_engine_available = */ [](bool) { return false; }, + nullptr, + nullptr, + nullptr, nullptr, }; #endif /* defined(GRPC_POSIX_SOCKET_EV_EPOLL1) */ diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index 0d35ff5df48..83c9c068997 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -1394,7 +1394,8 @@ const grpc_event_engine_vtable grpc_ev_poll_posix = { pollset_set_del_fd, is_any_background_poller_thread, - "poll", + /* name = */ "poll", + /* check_engine_available = */ [](bool) { if (!grpc_has_wakeup_fd()) { gpr_log(GPR_ERROR, "Skipping poll because of no wakeup fd."); @@ -1411,8 +1412,8 @@ const grpc_event_engine_vtable grpc_ev_poll_posix = { } return true; }, - []() {}, - shutdown_background_closure, + /* init_engine = */ []() {}, + /* shutdown_engine = */ shutdown_background_closure, []() {}, add_closure_to_background_poller, }; diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index e0e6e96bc5a..8504d93bad7 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -190,6 +190,7 @@ void grpc_register_event_engine_factory(const grpc_event_engine_vtable* vtable, if (first_null == nullptr) first_null = &g_vtables[i]; last_null = &g_vtables[i]; } else if (0 == strcmp(g_vtables[i]->name, vtable->name)) { + g_vtables[i] = vtable; return; } }