Skip to content

Commit b7522a2

Browse files
committed
patch 7.4.1379
Problem: Channel test fails on Win32 console. Solution: Don't sleep when timeout is zero. Call channel_wait() before channel_read(). Channels are not polled during ":sleep". (Yukihiro Nakadaira)
1 parent 65edff8 commit b7522a2

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

src/channel.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
15821582
&& nread > 0)
15831583
return OK;
15841584
diff = deadline - GetTickCount();
1585-
if (diff < 0)
1585+
if (diff <= 0)
15861586
break;
15871587
/* Wait for 5 msec.
15881588
* TODO: increase the sleep time when looping more often */
@@ -1881,17 +1881,19 @@ channel_fd2channel(sock_T fd, int *partp)
18811881
}
18821882
return NULL;
18831883
}
1884+
# endif
18841885

1886+
# if defined(WIN32) || defined(PROTO)
1887+
/*
1888+
* Check the channels for anything that is ready to be read.
1889+
* The data is put in the read queue.
1890+
*/
18851891
void
18861892
channel_handle_events(void)
18871893
{
18881894
channel_T *channel;
18891895
int part;
1890-
static int loop = 0;
1891-
1892-
/* Skip heavily polling */
1893-
if (loop++ % 2)
1894-
return;
1896+
sock_T fd;
18951897

18961898
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
18971899
{
@@ -1907,7 +1909,11 @@ channel_handle_events(void)
19071909
part = PART_SOCK;
19081910
# endif
19091911
# endif
1910-
channel_read(channel, part, "channel_handle_events");
1912+
{
1913+
fd = channel->ch_part[part].ch_fd;
1914+
if (fd != INVALID_FD && channel_wait(channel, fd, 0) == OK)
1915+
channel_read(channel, part, "channel_handle_events");
1916+
}
19111917
}
19121918
}
19131919
# endif

src/gui_w32.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,10 +2248,6 @@ gui_mch_wait_for_chars(int wtime)
22482248
parse_queued_messages();
22492249
#endif
22502250

2251-
#ifdef FEAT_CHANNEL
2252-
channel_handle_events();
2253-
#endif
2254-
22552251
/*
22562252
* Don't use gui_mch_update() because then we will spin-lock until a
22572253
* char arrives, instead we use GetMessage() to hang until an

src/misc2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6239,6 +6239,11 @@ has_non_ascii(char_u *s)
62396239
void
62406240
parse_queued_messages(void)
62416241
{
6242+
/* For Win32 mch_breakcheck() does not check for input, do it here. */
6243+
# if defined(WIN32) && defined(FEAT_CHANNEL)
6244+
channel_handle_events();
6245+
# endif
6246+
62426247
# ifdef FEAT_NETBEANS_INTG
62436248
/* Process the queued netbeans messages. */
62446249
netbeans_parse_messages();

src/os_win32.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,10 +1470,6 @@ WaitForChar(long msec)
14701470
serverProcessPendingMessages();
14711471
#endif
14721472

1473-
#ifdef FEAT_CHANNEL
1474-
channel_handle_events();
1475-
#endif
1476-
14771473
if (0
14781474
#ifdef FEAT_MOUSE
14791475
|| g_nMouseClick != -1

src/version.c

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

748748
static int included_patches[] =
749749
{ /* Add new patch number below this line */
750+
/**/
751+
1379,
750752
/**/
751753
1378,
752754
/**/

0 commit comments

Comments
 (0)