1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Added ELINKS_EPOLL_SIZE to the setup.h. 128 is enough for most uses.

This commit is contained in:
Witold Filipczyk 2007-01-03 12:54:05 +01:00 committed by Witold Filipczyk
parent 07ea72242e
commit 85cb16d14c
3 changed files with 5 additions and 7 deletions

View File

@ -120,7 +120,7 @@ init(void)
#endif #endif
#ifdef CONFIG_EPOLL #ifdef CONFIG_EPOLL
epoll_fd = epoll_create(1024); epoll_fd = epoll_create(ELINKS_EPOLL_SIZE);
if (epoll_fd == -1) { if (epoll_fd == -1) {
program.retval = RET_EPOLL; program.retval = RET_EPOLL;
program.terminate = 1; program.terminate = 1;

View File

@ -57,7 +57,7 @@ struct thread {
static struct thread threads[FD_SETSIZE]; static struct thread threads[FD_SETSIZE];
#ifdef CONFIG_EPOLL #ifdef CONFIG_EPOLL
static struct epoll_event events[FD_SETSIZE]; static struct epoll_event events[ELINKS_EPOLL_SIZE];
#else #else
static fd_set w_read; static fd_set w_read;
static fd_set w_write; static fd_set w_write;
@ -66,9 +66,8 @@ static fd_set w_error;
static fd_set x_read; static fd_set x_read;
static fd_set x_write; static fd_set x_write;
static fd_set x_error; static fd_set x_error;
#endif
static int w_max; static int w_max;
#endif
int int
get_file_handles_count(void) get_file_handles_count(void)
@ -172,10 +171,8 @@ set_handlers(int fd, select_handler_T read_func, select_handler_T write_func,
if (read_func || write_func || error_func) { if (read_func || write_func || error_func) {
if (epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fd, &ev)) if (epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fd, &ev))
epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev); epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev);
if (fd > w_max) w_max = fd;
} else { } else {
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, &ev); epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, &ev);
if (w_max == fd) w_max--;
} }
} }
@ -220,7 +217,7 @@ select_loop(void (*init)(void))
timeout = -1; timeout = -1;
} }
n = epoll_wait(epoll_fd, events, w_max, timeout); n = epoll_wait(epoll_fd, events, ELINKS_EPOLL_SIZE, timeout);
if (n < 0) { if (n < 0) {
/* The following calls (especially gettext) /* The following calls (especially gettext)
* might change errno. */ * might change errno. */

View File

@ -110,4 +110,5 @@
* to fit in the screen, with this much extra space. Try 4. */ * to fit in the screen, with this much extra space. Try 4. */
#define TABLE_LINE_PADDING -1 #define TABLE_LINE_PADDING -1
#define ELINKS_EPOLL_SIZE 128
#endif #endif