mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 04:22:47 -05:00
New timing infrastructure. There's a new function schedule_timer()
which pretty much any module can call to request a call-back in the future. So terminal.c can do its own handling of blinking, visual bells and deferred screen updates, without having to rely on term_update() being called 50 times a second (fixes: pterm-timer); and ssh.c and telnet.c both invoke a new module pinger.c which takes care of sending keepalives, so they get sent uniformly in all front ends (fixes: plink-keepalives, unix-keepalives). [originally from svn r4906] [this svn revision also touched putty-wishlist]
This commit is contained in:
@ -252,6 +252,7 @@ int main(int argc, char **argv)
|
||||
int errors;
|
||||
int use_subsystem = 0;
|
||||
void *ldisc, *logctx;
|
||||
long now;
|
||||
|
||||
ssh_get_line = console_get_line;
|
||||
|
||||
@ -584,6 +585,7 @@ int main(int argc, char **argv)
|
||||
atexit(cleanup_termios);
|
||||
ldisc_update(NULL, 1, 1);
|
||||
sending = FALSE;
|
||||
now = GETTICKCOUNT();
|
||||
|
||||
while (1) {
|
||||
fd_set rset, wset, xset;
|
||||
@ -644,7 +646,23 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
do {
|
||||
ret = select(maxfd, &rset, &wset, &xset, NULL);
|
||||
long next, ticks;
|
||||
struct timeval tv, *ptv;
|
||||
|
||||
if (run_timers(now, &next)) {
|
||||
ticks = next - GETTICKCOUNT();
|
||||
if (ticks < 0) ticks = 0; /* just in case */
|
||||
tv.tv_sec = ticks / 1000;
|
||||
tv.tv_usec = ticks % 1000 * 1000;
|
||||
ptv = &tv;
|
||||
} else {
|
||||
ptv = NULL;
|
||||
}
|
||||
ret = select(maxfd, &rset, &wset, &xset, ptv);
|
||||
if (ret == 0)
|
||||
now = next;
|
||||
else
|
||||
now = GETTICKCOUNT();
|
||||
} while (ret < 0 && errno == EINTR);
|
||||
|
||||
if (ret < 0) {
|
||||
|
Reference in New Issue
Block a user