diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-11-24 17:22:50 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-11-24 17:22:50 +0100 |
commit | 833eb1d752426689051bf2001083359899536939 (patch) | |
tree | f91eeead037b689d8d02bd1e47704332a63d7de0 /src/misc2.c | |
parent | 2cab0e191055a8145ccd46cd52869fbb9798b971 (diff) | |
download | vim-git-833eb1d752426689051bf2001083359899536939.tar.gz |
patch 8.0.0097v8.0.0097
Problem: When a channel callback consumes a lot of time Vim becomes
unresponsive. (skywind)
Solution: Bail out of checking channel readahead after 100 msec.
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c index 27d26bece..9fa11e3d2 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -6263,3 +6263,34 @@ parse_queued_messages(void) # endif } #endif + +#ifdef ELAPSED_TIMEVAL /* proto is defined in vim.h */ +/* + * Return time in msec since "start_tv". + */ + long +elapsed(struct timeval *start_tv) +{ + struct timeval now_tv; + + gettimeofday(&now_tv, NULL); + return (now_tv.tv_sec - start_tv->tv_sec) * 1000L + + (now_tv.tv_usec - start_tv->tv_usec) / 1000L; +} +#endif + +#ifdef ELAPSED_TICKCOUNT +/* + * Return time in msec since "start_tick". + */ + long +elapsed(DWORD start_tick) +{ + DWORD now = GetTickCount(); + + if (now < start_tick) + /* overflow */ + return (long)now; + return (long)now - (long)start_tick; +} +#endif |