Skip to content

Commit 8a8199e

Browse files
committed
patch 8.0.0103
Problem: May not process channel readahead. (skywind) Solution: If there is readahead don't block on input.
1 parent 7554da4 commit 8a8199e

File tree

6 files changed

+40
-5
lines changed

6 files changed

+40
-5
lines changed

src/channel.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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
*/

src/misc2.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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

src/os_unix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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
/*

src/os_win32.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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

src/proto/channel.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ int channel_poll_check(int ret_in, void *fds_in);
4444
int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in);
4545
int channel_select_check(int ret_in, void *rfds_in, void *wfds_in);
4646
int channel_parse_messages(void);
47+
int channel_any_readahead(void);
4748
int set_ref_in_channel(int copyID);
4849
ch_part_T channel_part_send(channel_T *channel);
4950
ch_part_T channel_part_read(channel_T *channel);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
103,
767769
/**/
768770
102,
769771
/**/

0 commit comments

Comments
 (0)