diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-21 17:20:55 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-21 17:20:55 +0100 |
commit | b7522a2f0ca6c970df37241c9e70024465d8596b (patch) | |
tree | 67c9867f97c1339af9da874ff290a55a58bc9b21 /src | |
parent | 65edff8f51e9e54f85407bdb9156ae8e3e1b76a1 (diff) | |
download | vim-git-b7522a2f0ca6c970df37241c9e70024465d8596b.tar.gz |
patch 7.4.1379v7.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)
Diffstat (limited to 'src')
-rw-r--r-- | src/channel.c | 20 | ||||
-rw-r--r-- | src/gui_w32.c | 4 | ||||
-rw-r--r-- | src/misc2.c | 5 | ||||
-rw-r--r-- | src/os_win32.c | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 20 insertions, 15 deletions
diff --git a/src/channel.c b/src/channel.c index aa478f16c..d02f0197e 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1582,7 +1582,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout) && nread > 0) return OK; diff = deadline - GetTickCount(); - if (diff < 0) + if (diff <= 0) break; /* Wait for 5 msec. * TODO: increase the sleep time when looping more often */ @@ -1881,17 +1881,19 @@ channel_fd2channel(sock_T fd, int *partp) } return NULL; } +# endif +# if defined(WIN32) || defined(PROTO) +/* + * Check the channels for anything that is ready to be read. + * The data is put in the read queue. + */ void channel_handle_events(void) { channel_T *channel; int part; - static int loop = 0; - - /* Skip heavily polling */ - if (loop++ % 2) - return; + sock_T fd; for (channel = first_channel; channel != NULL; channel = channel->ch_next) { @@ -1907,7 +1909,11 @@ channel_handle_events(void) part = PART_SOCK; # endif # endif - channel_read(channel, part, "channel_handle_events"); + { + fd = channel->ch_part[part].ch_fd; + if (fd != INVALID_FD && channel_wait(channel, fd, 0) == OK) + channel_read(channel, part, "channel_handle_events"); + } } } # endif diff --git a/src/gui_w32.c b/src/gui_w32.c index f3da79425..3a6469149 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -2248,10 +2248,6 @@ gui_mch_wait_for_chars(int wtime) parse_queued_messages(); #endif -#ifdef FEAT_CHANNEL - channel_handle_events(); -#endif - /* * Don't use gui_mch_update() because then we will spin-lock until a * char arrives, instead we use GetMessage() to hang until an diff --git a/src/misc2.c b/src/misc2.c index 9cfb11817..932d67e78 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -6239,6 +6239,11 @@ has_non_ascii(char_u *s) void parse_queued_messages(void) { + /* For Win32 mch_breakcheck() does not check for input, do it here. */ +# if defined(WIN32) && defined(FEAT_CHANNEL) + channel_handle_events(); +# endif + # ifdef FEAT_NETBEANS_INTG /* Process the queued netbeans messages. */ netbeans_parse_messages(); diff --git a/src/os_win32.c b/src/os_win32.c index ae1f0d8af..631f88e49 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -1470,10 +1470,6 @@ WaitForChar(long msec) serverProcessPendingMessages(); #endif -#ifdef FEAT_CHANNEL - channel_handle_events(); -#endif - if (0 #ifdef FEAT_MOUSE || g_nMouseClick != -1 diff --git a/src/version.c b/src/version.c index 748371fc6..b5f482536 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1379, +/**/ 1378, /**/ 1377, |