From 63e2ce61a84670ea46637fb7026fde0b6af9372b Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 2 Jun 2017 14:36:39 +0200 Subject: [PATCH] MINOR: threads/polling: pollers now handle FDs depending on the process mask --- src/ev_epoll.c | 2 +- src/ev_kqueue.c | 2 +- src/ev_poll.c | 4 ++++ src/ev_select.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ev_epoll.c b/src/ev_epoll.c index 0b815b45b..642b4d61f 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -136,7 +136,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) unsigned int e = epoll_events[count].events; fd = epoll_events[count].data.fd; - if (!fdtab[fd].owner) + if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit)) continue; /* it looks complicated but gcc can optimize it away when constants diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index 326d61607..8f20db26a 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -122,7 +122,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) unsigned int n = 0; fd = kev[count].ident; - if (!fdtab[fd].owner) + if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit)) continue; if (kev[count].filter == EVFILT_READ) { diff --git a/src/ev_poll.c b/src/ev_poll.c index e16968bcf..455c4e1e9 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -111,6 +111,10 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) continue; for (count = 0, fd = fds * 8*sizeof(**fd_evts); count < 8*sizeof(**fd_evts) && fd < maxfd; count++, fd++) { + + if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit)) + continue; + sr = (rn >> count) & 1; sw = (wn >> count) & 1; if ((sr|sw)) { diff --git a/src/ev_select.c b/src/ev_select.c index 97d42861f..49e980f00 100644 --- a/src/ev_select.c +++ b/src/ev_select.c @@ -141,7 +141,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) /* if we specify read first, the accepts and zero reads will be * seen first. Moreover, system buffers will be flushed faster. */ - if (!fdtab[fd].owner) + if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit)) continue; if (FD_ISSET(fd, tmp_evts[DIR_RD])) -- 2.47.3