Reduce amount of epoll events

This commit is contained in:
blankie 2023-03-07 20:55:24 +07:00
parent 626e081876
commit fac2cb08f1
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 2 additions and 4 deletions

View File

@ -16,8 +16,6 @@
#include "logcat_thread.h" #include "logcat_thread.h"
#include "logcat_entry.h" #include "logcat_entry.h"
#define EPOLL_MAX_EVENTS 10
static void mark_nonblock(int fd) { static void mark_nonblock(int fd) {
int flags = fcntl(fd, F_GETFL); int flags = fcntl(fd, F_GETFL);
if (flags < 0) { if (flags < 0) {
@ -223,9 +221,9 @@ void LogcatThread::_run_read_round() {
}; };
#ifdef USE_EPOLL #ifdef USE_EPOLL
struct epoll_event events[EPOLL_MAX_EVENTS]; struct epoll_event events[2];
int ready_fds = epoll_wait(this->_epoll_fd, events, EPOLL_MAX_EVENTS, 1000); int ready_fds = epoll_wait(this->_epoll_fd, events, 2, 1000);
if (ready_fds == -1) { if (ready_fds == -1) {
if (errno == EINTR) { if (errno == EINTR) {
return; return;