0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 7.4.2282

Problem:    When a child process is very fast waiting 10 msec for it is
            noticeable. (Ramel Eshed)
Solution:   Start waiting for 1 msec and gradually increase.
This commit is contained in:
Bram Moolenaar
2016-08-28 16:53:12 +02:00
parent 0426bae2ab
commit 0abe0522d0
2 changed files with 14 additions and 3 deletions

View File

@@ -3934,6 +3934,7 @@ mch_new_shellsize(void)
wait4pid(pid_t child, waitstatus *status) wait4pid(pid_t child, waitstatus *status)
{ {
pid_t wait_pid = 0; pid_t wait_pid = 0;
long delay_msec = 1;
while (wait_pid != child) while (wait_pid != child)
{ {
@@ -3948,8 +3949,10 @@ wait4pid(pid_t child, waitstatus *status)
# endif # endif
if (wait_pid == 0) if (wait_pid == 0)
{ {
/* Wait for 10 msec before trying again. */ /* Wait for 1 to 10 msec before trying again. */
mch_delay(10L, TRUE); mch_delay(delay_msec, TRUE);
if (++delay_msec > 10)
delay_msec = 10;
continue; continue;
} }
if (wait_pid <= 0 if (wait_pid <= 0
@@ -4929,6 +4932,8 @@ finished:
# if defined(FEAT_XCLIPBOARD) && defined(FEAT_X11) # if defined(FEAT_XCLIPBOARD) && defined(FEAT_X11)
else else
{ {
long delay_msec = 1;
/* /*
* Similar to the loop above, but only handle X events, no * Similar to the loop above, but only handle X events, no
* I/O. * I/O.
@@ -4961,7 +4966,11 @@ finished:
/* Handle any X events, e.g. serving the clipboard. */ /* Handle any X events, e.g. serving the clipboard. */
clip_update(); clip_update();
mch_delay(10L, TRUE); /* Wait for 1 to 10 msec. 1 is faster but gives the child
* less time. */
mch_delay(delay_msec, TRUE);
if (++delay_msec > 10)
delay_msec = 10;
} }
} }
# endif # endif

View File

@@ -763,6 +763,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 */
/**/
2282,
/**/ /**/
2281, 2281,
/**/ /**/