From 22b39daf06c52766e7b2a0c971cd970ce7890bed Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 15 Feb 2017 19:44:54 +0200 Subject: [PATCH] Make EPOLLET the default The whole worker thread mechanism assumes EPOLLET and non-blocking descriptors, so that should be the default. TODO: In debug mode, check that the provided file descriptor indeed is non-blocking. --- include/maxscale/poll_core.h | 4 +++- server/core/poll.cc | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/maxscale/poll_core.h b/include/maxscale/poll_core.h index 0f68e783b..4bc6b3af2 100644 --- a/include/maxscale/poll_core.h +++ b/include/maxscale/poll_core.h @@ -76,7 +76,9 @@ typedef struct mxs_poll_data * data->thread.id: Will be updated by `poll_add_fd_to_worker`. * * @attention If the descriptor should be added to all workers, then the worker - * thread id will be 0. + * thread id will be 0. + * + * @attention The provided file descriptor *must* be non-blocking. * * @return 0 on success, non-zero on failure. */ diff --git a/server/core/poll.cc b/server/core/poll.cc index 89236b0e7..0a3e48c02 100644 --- a/server/core/poll.cc +++ b/server/core/poll.cc @@ -291,6 +291,8 @@ static int add_fd_to_worker(int wid, int fd, uint32_t events, MXS_POLL_DATA* dat { ss_dassert((wid >= 0) && (wid <= n_threads)); + events |= EPOLLET; + struct epoll_event ev; ev.events = events; @@ -309,6 +311,8 @@ static int add_fd_to_worker(int wid, int fd, uint32_t events, MXS_POLL_DATA* dat static int add_fd_to_workers(int fd, uint32_t events, MXS_POLL_DATA* data) { + events |= EPOLLET; + struct epoll_event ev; ev.events = events;