zos: move mq check out of loop to save cpu cycles

PR-URL: https://github.com/libuv/libuv/pull/2013
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
Irek Fakhrutdinov 2020-03-15 11:12:42 +01:00 committed by Ben Noordhuis
parent f06734057b
commit 7d988e0763

View File

@ -286,6 +286,8 @@ int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events,
int pollret;
int reventcount;
int nevents;
struct pollfd msg_fd;
int i;
_SET_FDS_MSGS(size, 1, lst->size - 1);
pfds = lst->items;
@ -297,7 +299,8 @@ int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events,
reventcount = 0;
nevents = 0;
for (int i = 0;
msg_fd = pfds[lst->size - 1];
for (i = 0;
i < lst->size && i < maxevents && reventcount < pollret; ++i) {
struct epoll_event ev;
struct pollfd* pfd;
@ -308,11 +311,7 @@ int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events,
ev.fd = pfd->fd;
ev.events = pfd->revents;
if (i == lst->size - 1)
ev.is_msg = 1;
else
ev.is_msg = 0;
ev.is_msg = 0;
if (pfd->revents & POLLIN && pfd->revents & POLLOUT)
reventcount += 2;
else if (pfd->revents & (POLLIN | POLLOUT))
@ -322,6 +321,10 @@ int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events,
events[nevents++] = ev;
}
if (msg_fd.revents != 0 && msg_fd.fd != -1)
if (i == lst->size)
events[nevents - 1].is_msg = 1;
return nevents;
}