Skip to content

Commit

Permalink
Merge pull request #4 from Marshal313/master
Browse files Browse the repository at this point in the history
Fix epoll timeout
  • Loading branch information
dvershinin committed Jun 28, 2019
2 parents bfe5b68 + c33989e commit ee2fcdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions engine/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ void default_engine_server_start (void) /* {{{ */ {
int i;
vkprintf (0, "main loop\n");
for (i = 0; ; i++) {
epoll_work (engine_check_multithread_enabled () ? E->epoll_wait_timeout : 1);
epoll_work (engine_check_multithread_enabled () ? E->epoll_wait_timeout : DEFAULT_EPOLL_WAIT_TIMEOUT);
if (interrupt_signal_raised ()) {
if (F->on_waiting_exit) {
while (1) {
Expand Down Expand Up @@ -554,7 +554,7 @@ static void check_server_functions (void) /* {{{ */ {
if (!F->parse_extra_args) { F->parse_extra_args = default_parse_extra_args; }
if (!F->pre_loop) { F->pre_loop = default_nop; }

if (!F->epoll_timeout) { F->epoll_timeout = 1; }
if (!F->epoll_timeout) { F->epoll_timeout = DEFAULT_EPOLL_WAIT_TIMEOUT; }
if (!F->aio_timeout) { F->aio_timeout = 0.5; }

if (!F->get_op) { F->get_op = default_get_op; }
Expand Down Expand Up @@ -590,6 +590,7 @@ void engine_startup (engine_t *E, server_functions_t *F) /* {{{ */ {
/* }}} */

int default_main (server_functions_t *F, int argc, char *argv[]) {
F->epoll_timeout = DEFAULT_EPOLL_WAIT_TIMEOUT;
set_signals_handlers ();

engine_t *E = calloc (sizeof (*E), 1);
Expand Down
2 changes: 1 addition & 1 deletion net/net-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ int epoll_work (int timeout) {

double epoll_wait_start = get_utime_monotonic ();

epoll_fetch_events (1);
epoll_fetch_events (timeout);

last_epoll_wait_at = get_utime_monotonic ();
double epoll_wait_time = last_epoll_wait_at - epoll_wait_start;
Expand Down

0 comments on commit ee2fcdb

Please sign in to comment.