diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-28 19:16:20 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-28 19:16:20 +0200 |
commit | 8b877ac38e96424a08a8b8eb713ef4b3cf0064be (patch) | |
tree | c72ac7aa90e66ad1e6d6c82fb27ab7d74de3eea9 /src/os_unix.c | |
parent | ee1f7b3cb71684aaa9bf457e2caf9d02187e6b7c (diff) | |
download | vim-git-8b877ac38e96424a08a8b8eb713ef4b3cf0064be.tar.gz |
patch 7.4.1669v7.4.1669
Problem: When writing buffer lines to a pipe Vim may block.
Solution: Avoid blocking, write more lines later.
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 74ffe9300..dc8e00952 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5539,7 +5539,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *break_loop) # endif #endif #ifndef HAVE_SELECT - struct pollfd fds[6 + MAX_OPEN_CHANNELS]; + /* each channel may use in, out and err */ + struct pollfd fds[6 + 3 * MAX_OPEN_CHANNELS]; int nfd; # ifdef FEAT_XCLIPBOARD int xterm_idx = -1; @@ -5652,7 +5653,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *break_loop) struct timeval tv; struct timeval *tvp; - fd_set rfds, efds; + fd_set rfds, wfds, efds; int maxfd; long towait = msec; @@ -5685,6 +5686,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *break_loop) */ select_eintr: FD_ZERO(&rfds); + FD_ZERO(&wfds); FD_ZERO(&efds); FD_SET(fd, &rfds); # if !defined(__QNX__) && !defined(__CYGWIN32__) @@ -5725,10 +5727,10 @@ select_eintr: } # endif # ifdef FEAT_JOB_CHANNEL - maxfd = channel_select_setup(maxfd, &rfds); + maxfd = channel_select_setup(maxfd, &rfds, &wfds); # endif - ret = select(maxfd + 1, &rfds, NULL, &efds, tvp); + ret = select(maxfd + 1, &rfds, &wfds, &efds, tvp); result = ret > 0 && FD_ISSET(fd, &rfds); if (result) --ret; @@ -5810,7 +5812,7 @@ select_eintr: # endif #ifdef FEAT_JOB_CHANNEL if (ret > 0) - ret = channel_select_check(ret, &rfds); + ret = channel_select_check(ret, &rfds, &wfds); #endif #endif /* HAVE_SELECT */ |