try reduce the number of call ff_linux_epoll_wait().

This commit is contained in:
fengbojiang 2023-04-27 20:41:54 +08:00
parent 8ae79cd438
commit 85173ced83
1 changed files with 10 additions and 6 deletions

View File

@ -1788,13 +1788,17 @@ RETRY:
DEBUG_LOG("call ff_linux_epoll_wait at the same time, epfd:%d, fstack_kernel_fd_map[epfd]:%d, kernel_maxevents:%d\n",
fd, fstack_kernel_fd_map[fd], kernel_maxevents);
if (likely(fstack_kernel_fd_map[fd] > 0)) {
kernel_ret = ff_linux_epoll_wait(fstack_kernel_fd_map[fd], events, kernel_maxevents, 0);
DEBUG_LOG("ff_linux_epoll_wait kernel_ret:%d, errno:%d\n", ret, errno);
if (kernel_ret < 0) {
kernel_ret = 0;
} else if (kernel_ret > 0) {
events += kernel_ret;
static uint64_t count = 0;
if (unlikely(count & 0xff == 0)) {
kernel_ret = ff_linux_epoll_wait(fstack_kernel_fd_map[fd], events, kernel_maxevents, 0);
DEBUG_LOG("ff_linux_epoll_wait kernel_ret:%d, errno:%d\n", ret, errno);
if (kernel_ret < 0) {
kernel_ret = 0;
} else if (kernel_ret > 0) {
events += kernel_ret;
}
}
count++;
}
#endif