]> granicus.if.org Git - vim/commitdiff
patch 8.0.0103 v8.0.0103
authorBram Moolenaar <Bram@vim.org>
Sat, 26 Nov 2016 14:13:33 +0000 (15:13 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 26 Nov 2016 14:13:33 +0000 (15:13 +0100)
Problem:    May not process channel readahead. (skywind)
Solution:   If there is readahead don't block on input.

src/channel.c
src/misc2.c
src/os_unix.c
src/os_win32.c
src/proto/channel.pro
src/version.c

index 19520e200753f8f28b67eddb0924d42b1da9e268..6c5a4ff1d67a4fc0ba6805e30fc016ff1c2e3be1 100644 (file)
@@ -3899,6 +3899,31 @@ channel_parse_messages(void)
     return ret;
 }
 
+/*
+ * 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.
  */
index 9fa11e3d25a4ae4aea5f212466792d791aa21557..7f23c43e9a9c23bdbf30f76b188f57306c442b62 100644 (file)
@@ -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
index 12fb33b7ae97609d30de27308186dc7901db2571..aa3c3e506d8787c763071d390868a85147e20f8f 100644 (file)
@@ -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
 
        /*
index 23044381d03ebe3de9b45dabf2eeff390befdeb5..e08adcbb19c8dc72bbb26556e57f5f5a63f9115c 100644 (file)
@@ -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
index 6a52d8b2ba2232df2ef21a63f724e83aade3d93b..8640fa7bb78a3c3795d8402ee07723e89ead24ff 100644 (file)
@@ -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);
index ed6a74e88bde4e6e512eb9822bbf90d7425b97c4..4dcbcfb733840c3cdf4630672cae96f2b767e1e1 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    103,
 /**/
     102,
 /**/