forked from aniani/vim
patch 8.1.1853: timers test is still flaky
Problem: Timers test is still flaky. Solution: Compute the time to sleep more accurately.
This commit is contained in:
@@ -7675,12 +7675,19 @@ ex_sleep(exarg_T *eap)
|
|||||||
void
|
void
|
||||||
do_sleep(long msec)
|
do_sleep(long msec)
|
||||||
{
|
{
|
||||||
long done;
|
long done = 0;
|
||||||
long wait_now;
|
long wait_now;
|
||||||
|
# ifdef ELAPSED_FUNC
|
||||||
|
elapsed_T start_tv;
|
||||||
|
|
||||||
|
// Remember at what time we started, so that we know how much longer we
|
||||||
|
// should wait after waiting for a bit.
|
||||||
|
ELAPSED_INIT(start_tv);
|
||||||
|
# endif
|
||||||
|
|
||||||
cursor_on();
|
cursor_on();
|
||||||
out_flush_cursor(FALSE, FALSE);
|
out_flush_cursor(FALSE, FALSE);
|
||||||
for (done = 0; !got_int && done < msec; done += wait_now)
|
while (!got_int && done < msec)
|
||||||
{
|
{
|
||||||
wait_now = msec - done > 1000L ? 1000L : msec - done;
|
wait_now = msec - done > 1000L ? 1000L : msec - done;
|
||||||
#ifdef FEAT_TIMERS
|
#ifdef FEAT_TIMERS
|
||||||
@@ -7700,6 +7707,7 @@ do_sleep(long msec)
|
|||||||
wait_now = 20L;
|
wait_now = 20L;
|
||||||
#endif
|
#endif
|
||||||
ui_delay(wait_now, TRUE);
|
ui_delay(wait_now, TRUE);
|
||||||
|
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
if (has_any_channel())
|
if (has_any_channel())
|
||||||
ui_breakcheck_force(TRUE);
|
ui_breakcheck_force(TRUE);
|
||||||
@@ -7707,11 +7715,19 @@ do_sleep(long msec)
|
|||||||
#endif
|
#endif
|
||||||
ui_breakcheck();
|
ui_breakcheck();
|
||||||
#ifdef MESSAGE_QUEUE
|
#ifdef MESSAGE_QUEUE
|
||||||
/* Process the netbeans and clientserver messages that may have been
|
// Process the netbeans and clientserver messages that may have been
|
||||||
* received in the call to ui_breakcheck() when the GUI is in use. This
|
// received in the call to ui_breakcheck() when the GUI is in use. This
|
||||||
* may occur when running a test case. */
|
// may occur when running a test case.
|
||||||
parse_queued_messages();
|
parse_queued_messages();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
# ifdef ELAPSED_FUNC
|
||||||
|
// actual time passed
|
||||||
|
done = ELAPSED_FUNC(start_tv);
|
||||||
|
# else
|
||||||
|
// guestimate time passed (will actually be more)
|
||||||
|
done += wait_now;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// If CTRL-C was typed to interrupt the sleep, drop the CTRL-C from the
|
// If CTRL-C was typed to interrupt the sleep, drop the CTRL-C from the
|
||||||
|
@@ -769,6 +769,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 */
|
||||||
|
/**/
|
||||||
|
1853,
|
||||||
/**/
|
/**/
|
||||||
1852,
|
1852,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user