summaryrefslogtreecommitdiff
path: root/sysdep/unix/io.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-11-17 12:04:24 +0000
committerMartin Mares <mj@ucw.cz>1999-11-17 12:04:24 +0000
commit30770df2ab33ffbfd75a9478265ac5e1a1db98d9 (patch)
treef63da9733ab5ca61d7706e6746cdbac4c9efd520 /sysdep/unix/io.c
parent84a7d7f77c05578d9ebfff90672e73f021999d25 (diff)
If the main event queue is not empty, call select() with zero timeout, so
that the events are ran again after the FD's are checked. This allows us to schedule I/O checks between processing of user commands.
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r--sysdep/unix/io.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index aef348ce..5bc9b5ac 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -894,7 +894,7 @@ io_loop(void)
fd_set rd, wr;
struct timeval timo;
time_t tout;
- int hi;
+ int hi, events;
sock *s;
node *n, *p;
@@ -904,7 +904,7 @@ io_loop(void)
FD_ZERO(&wr);
for(;;)
{
- ev_run_list(&global_event_list);
+ events = ev_run_list(&global_event_list);
now = time(NULL);
tout = tm_first_shot();
if (tout <= now)
@@ -912,11 +912,8 @@ io_loop(void)
tm_shot();
continue;
}
- else
- {
- timo.tv_sec = tout - now;
- timo.tv_usec = 0;
- }
+ timo.tv_sec = events ? 0 : tout - now;
+ timo.tv_usec = 0;
hi = 0;
WALK_LIST(n, sock_list)