mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 7.4.1667
Problem: Win32: waiting on a pipe with fixed sleep time. Solution: Start with a short delay and increase it when looping.
This commit is contained in:
@@ -2371,8 +2371,9 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
|
|||||||
if (fd != channel->CH_SOCK_FD)
|
if (fd != channel->CH_SOCK_FD)
|
||||||
{
|
{
|
||||||
DWORD nread;
|
DWORD nread;
|
||||||
int diff;
|
int sleep_time;
|
||||||
DWORD deadline = GetTickCount() + timeout;
|
DWORD deadline = GetTickCount() + timeout;
|
||||||
|
int delay = 1;
|
||||||
|
|
||||||
/* reading from a pipe, not a socket */
|
/* reading from a pipe, not a socket */
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
@@ -2380,12 +2381,17 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
|
|||||||
if (PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL)
|
if (PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL)
|
||||||
&& nread > 0)
|
&& nread > 0)
|
||||||
return OK;
|
return OK;
|
||||||
diff = deadline - GetTickCount();
|
sleep_time = deadline - GetTickCount();
|
||||||
if (diff <= 0)
|
if (sleep_time <= 0)
|
||||||
break;
|
break;
|
||||||
/* Wait for 5 msec.
|
/* Wait for a little while. Very short at first, up to 10 msec
|
||||||
* TODO: increase the sleep time when looping more often */
|
* after looping a few times. */
|
||||||
Sleep(5);
|
if (sleep_time > delay)
|
||||||
|
sleep_time = delay;
|
||||||
|
Sleep(sleep_time);
|
||||||
|
delay = delay * 2;
|
||||||
|
if (delay > 10)
|
||||||
|
delay = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1667,
|
||||||
/**/
|
/**/
|
||||||
1666,
|
1666,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user