aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/ev_posix.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/iomgr/ev_posix.cc')
-rw-r--r--src/core/lib/iomgr/ev_posix.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc
index e4033fab1d..369baa621f 100644
--- a/src/core/lib/iomgr/ev_posix.cc
+++ b/src/core/lib/iomgr/ev_posix.cc
@@ -61,12 +61,30 @@ typedef struct {
event_engine_factory_fn factory;
} event_engine_factory;
+namespace {
+extern "C" {
+int dummypoll(struct pollfd fds[], nfds_t nfds, int timeout) {
+ gpr_log(GPR_ERROR, "Attempted to poll despite declaring non-polling.");
+ GPR_ASSERT(false);
+ return -1;
+}
+} // extern "C"
+
+const grpc_event_engine_vtable *init_non_polling(bool explicit_request) {
+ // return the simplest engine as a dummy but also override the poller
+ auto ret = grpc_init_poll_posix(explicit_request);
+ grpc_poll_function = dummypoll;
+ return ret;
+}
+} // namespace
+
static const event_engine_factory g_factories[] = {
{"epoll1", grpc_init_epoll1_linux},
{"epollsig", grpc_init_epollsig_linux},
{"poll", grpc_init_poll_posix},
{"poll-cv", grpc_init_poll_cv_posix},
{"epollex", grpc_init_epollex_linux},
+ {"none", init_non_polling},
};
static void add(const char *beg, const char *end, char ***ss, size_t *ns) {