summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-11-26 15:13:33 +0100
committerBram Moolenaar <Bram@vim.org>2016-11-26 15:13:33 +0100
commit8a8199e4a1814b10630a770165502abb1121cd1b (patch)
treec6fe9958116a7cea4ca4bcbdb18c2b3f33bf4530
parent7554da4033498c4da0af3cde542c3e87e9097b73 (diff)
patch 8.0.0103v8.0.0103
Problem: May not process channel readahead. (skywind) Solution: If there is readahead don't block on input.
-rw-r--r--src/channel.c25
-rw-r--r--src/misc2.c5
-rw-r--r--src/os_unix.c4
-rw-r--r--src/os_win32.c8
-rw-r--r--src/proto/channel.pro1
-rw-r--r--src/version.c2
6 files changed, 40 insertions, 5 deletions
diff --git a/src/channel.c b/src/channel.c
index 19520e2007..6c5a4ff1d6 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -3900,6 +3900,31 @@ channel_parse_messages(void)
}
/*
+ * Return TRUE if any channel has readahead. That means we should not block on
+ * waiting for input.
+ */
+ int
+channel_any_readahead(void)
+{
+ channel_T *channel = first_channel;
+ ch_part_T part = PART_SOCK;
+
+ while (channel != NULL)
+ {
+ if (channel_has_readahead(channel, part))
+ return TRUE;
+ if (part < PART_ERR)
+ ++part;
+ else
+ {
+ channel = channel->ch_next;
+ part = PART_SOCK;
+ }
+ }
+ return FALSE;
+}
+
+/*
* Mark references to lists used in channels.
*/
int
diff --git a/src/misc2.c b/src/misc2.c
index 9fa11e3d25..7f23c43e9a 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -6264,7 +6264,7 @@ parse_queued_messages(void)
}
#endif
-#ifdef ELAPSED_TIMEVAL /* proto is defined in vim.h */
+#ifdef ELAPSED_TIMEVAL /* no PROTO here, proto is defined in vim.h */
/*
* Return time in msec since "start_tv".
*/
@@ -6288,9 +6288,6 @@ elapsed(DWORD start_tick)
{
DWORD now = GetTickCount();
- if (now < start_tick)
- /* overflow */
- return (long)now;
return (long)now - (long)start_tick;
}
#endif
diff --git a/src/os_unix.c b/src/os_unix.c
index 12fb33b7ae..aa3c3e506d 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -462,6 +462,10 @@ mch_inchar(
/* Checking if a job ended requires polling. Do this every 100 msec. */
if (has_pending_job() && (wait_time < 0 || wait_time > 100L))
wait_time = 100L;
+ /* If there is readahead then parse_queued_messages() timed out and we
+ * should call it again soon. */
+ if ((wait_time < 0 || wait_time > 100L) && channel_any_readahead())
+ wait_time = 10L;
#endif
/*
diff --git a/src/os_win32.c b/src/os_win32.c
index 23044381d0..e08adcbb19 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1351,9 +1351,15 @@ WaitForChar(long msec)
DWORD dwWaitTime = dwEndTime - dwNow;
#ifdef FEAT_JOB_CHANNEL
- /* Check channel while waiting input. */
+ /* Check channel while waiting for input. */
if (dwWaitTime > 100)
+ {
dwWaitTime = 100;
+ /* If there is readahead then parse_queued_messages() timed out
+ * and we should call it again soon. */
+ if (channel_any_readahead())
+ dwWaitTime = 10;
+ }
#endif
#ifdef FEAT_MZSCHEME
if (mzthreads_allowed() && p_mzq > 0
diff --git a/src/proto/channel.pro b/src/proto/channel.pro
index 6a52d8b2ba..8640fa7bb7 100644
--- a/src/proto/channel.pro
+++ b/src/proto/channel.pro
@@ -44,6 +44,7 @@ int channel_poll_check(int ret_in, void *fds_in);
int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in);
int channel_select_check(int ret_in, void *rfds_in, void *wfds_in);
int channel_parse_messages(void);
+int channel_any_readahead(void);
int set_ref_in_channel(int copyID);
ch_part_T channel_part_send(channel_T *channel);
ch_part_T channel_part_read(channel_T *channel);
diff --git a/src/version.c b/src/version.c
index ed6a74e88b..4dcbcfb733 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 103,
+/**/
102,
/**/
101,