File tree Expand file tree Collapse file tree 6 files changed +40
-5
lines changed
Expand file tree Collapse file tree 6 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -3899,6 +3899,31 @@ channel_parse_messages(void)
38993899 return ret ;
39003900}
39013901
3902+ /*
3903+ * Return TRUE if any channel has readahead. That means we should not block on
3904+ * waiting for input.
3905+ */
3906+ int
3907+ channel_any_readahead (void )
3908+ {
3909+ channel_T * channel = first_channel ;
3910+ ch_part_T part = PART_SOCK ;
3911+
3912+ while (channel != NULL )
3913+ {
3914+ if (channel_has_readahead (channel , part ))
3915+ return TRUE;
3916+ if (part < PART_ERR )
3917+ ++ part ;
3918+ else
3919+ {
3920+ channel = channel -> ch_next ;
3921+ part = PART_SOCK ;
3922+ }
3923+ }
3924+ return FALSE;
3925+ }
3926+
39023927/*
39033928 * Mark references to lists used in channels.
39043929 */
Original file line number Diff line number Diff line change @@ -6264,7 +6264,7 @@ parse_queued_messages(void)
62646264}
62656265#endif
62666266
6267- #ifdef ELAPSED_TIMEVAL /* proto is defined in vim.h */
6267+ #ifdef ELAPSED_TIMEVAL /* no PROTO here, proto is defined in vim.h */
62686268/*
62696269 * Return time in msec since "start_tv".
62706270 */
@@ -6288,9 +6288,6 @@ elapsed(DWORD start_tick)
62886288{
62896289 DWORD now = GetTickCount ();
62906290
6291- if (now < start_tick )
6292- /* overflow */
6293- return (long )now ;
62946291 return (long )now - (long )start_tick ;
62956292}
62966293#endif
Original file line number Diff line number Diff line change @@ -462,6 +462,10 @@ mch_inchar(
462462 /* Checking if a job ended requires polling. Do this every 100 msec. */
463463 if (has_pending_job () && (wait_time < 0 || wait_time > 100L ))
464464 wait_time = 100L ;
465+ /* If there is readahead then parse_queued_messages() timed out and we
466+ * should call it again soon. */
467+ if ((wait_time < 0 || wait_time > 100L ) && channel_any_readahead ())
468+ wait_time = 10L ;
465469#endif
466470
467471 /*
Original file line number Diff line number Diff line change @@ -1351,9 +1351,15 @@ WaitForChar(long msec)
13511351 DWORD dwWaitTime = dwEndTime - dwNow ;
13521352
13531353#ifdef FEAT_JOB_CHANNEL
1354- /* Check channel while waiting input. */
1354+ /* Check channel while waiting for input. */
13551355 if (dwWaitTime > 100 )
1356+ {
13561357 dwWaitTime = 100 ;
1358+ /* If there is readahead then parse_queued_messages() timed out
1359+ * and we should call it again soon. */
1360+ if (channel_any_readahead ())
1361+ dwWaitTime = 10 ;
1362+ }
13571363#endif
13581364#ifdef FEAT_MZSCHEME
13591365 if (mzthreads_allowed () && p_mzq > 0
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ int channel_poll_check(int ret_in, void *fds_in);
4444int channel_select_setup (int maxfd_in , void * rfds_in , void * wfds_in );
4545int channel_select_check (int ret_in , void * rfds_in , void * wfds_in );
4646int channel_parse_messages (void );
47+ int channel_any_readahead (void );
4748int set_ref_in_channel (int copyID );
4849ch_part_T channel_part_send (channel_T * channel );
4950ch_part_T channel_part_read (channel_T * channel );
Original file line number Diff line number Diff line change @@ -764,6 +764,8 @@ static char *(features[]) =
764764
765765static int included_patches [] =
766766{ /* Add new patch number below this line */
767+ /**/
768+ 103 ,
767769/**/
768770 102 ,
769771/**/
You can’t perform that action at this time.
0 commit comments