comparison src/os_unix.c @ 8112:a62ff5ff60c1 v7.4.1350

commit https://github.com/vim/vim/commit/ec70bdd68a531762a62728747ab529d7a6dfc842 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 18 22:17:42 2016 +0100 patch 7.4.1350 Problem: When the test server fails to start Vim hangs. Solution: Check that there is actually something to read from the tty fd.
author Christian Brabandt <cb@256bit.org>
date Thu, 18 Feb 2016 22:30:07 +0100
parents 18a3f0f05244
children 989ac3aed1ef
comparison
equal deleted inserted replaced
8111:b741d3837a9e 8112:a62ff5ff60c1
5343 * Or when a clientserver message is on the queue. 5343 * Or when a clientserver message is on the queue.
5344 */ 5344 */
5345 #if defined(__BEOS__) 5345 #if defined(__BEOS__)
5346 int 5346 int
5347 #else 5347 #else
5348 static int 5348 static int
5349 #endif 5349 #endif
5350 RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED) 5350 RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
5351 { 5351 {
5352 int ret; 5352 int ret;
5353 int result;
5353 #if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME) 5354 #if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME)
5354 static int busy = FALSE; 5355 static int busy = FALSE;
5355 5356
5356 /* May retry getting characters after an event was handled. */ 5357 /* May retry getting characters after an event was handled. */
5357 # define MAY_LOOP 5358 # define MAY_LOOP
5464 #ifdef FEAT_CHANNEL 5465 #ifdef FEAT_CHANNEL
5465 nfd = channel_poll_setup(nfd, &fds); 5466 nfd = channel_poll_setup(nfd, &fds);
5466 #endif 5467 #endif
5467 5468
5468 ret = poll(fds, nfd, towait); 5469 ret = poll(fds, nfd, towait);
5470
5471 result = ret > 0 && (fds[0].revents & POLLIN);
5472
5469 # ifdef FEAT_MZSCHEME 5473 # ifdef FEAT_MZSCHEME
5470 if (ret == 0 && mzquantum_used) 5474 if (ret == 0 && mzquantum_used)
5471 /* MzThreads scheduling is required and timeout occurred */ 5475 /* MzThreads scheduling is required and timeout occurred */
5472 finished = FALSE; 5476 finished = FALSE;
5473 # endif 5477 # endif
5611 # ifdef FEAT_CHANNEL 5615 # ifdef FEAT_CHANNEL
5612 maxfd = channel_select_setup(maxfd, &rfds); 5616 maxfd = channel_select_setup(maxfd, &rfds);
5613 # endif 5617 # endif
5614 5618
5615 ret = select(maxfd + 1, &rfds, NULL, &efds, tvp); 5619 ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
5620 result = ret > 0 && FD_ISSET(fd, &rfds);
5621 if (result)
5622 --ret;
5623
5616 # ifdef EINTR 5624 # ifdef EINTR
5617 if (ret == -1 && errno == EINTR) 5625 if (ret == -1 && errno == EINTR)
5618 { 5626 {
5619 /* Check whether window has been resized, EINTR may be caused by 5627 /* Check whether window has been resized, EINTR may be caused by
5620 * SIGWINCH. */ 5628 * SIGWINCH. */
5731 break; /* waited long enough */ 5739 break; /* waited long enough */
5732 } 5740 }
5733 #endif 5741 #endif
5734 } 5742 }
5735 5743
5736 return (ret > 0); 5744 return result;
5737 } 5745 }
5738 5746
5739 #ifndef NO_EXPANDPATH 5747 #ifndef NO_EXPANDPATH
5740 /* 5748 /*
5741 * Expand a path into all matching files and/or directories. Handles "*", 5749 * Expand a path into all matching files and/or directories. Handles "*",