To: vim_dev@googlegroups.com Subject: Patch 8.1.1853 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1853 Problem: Timers test is still flaky. Solution: Compute the time to sleep more accurately. Files: src/ex_docmd.c *** ../vim-8.1.1852/src/ex_docmd.c 2019-08-15 23:05:46.046376789 +0200 --- src/ex_docmd.c 2019-08-16 10:20:38.978920303 +0200 *************** *** 7675,7686 **** void do_sleep(long msec) { ! long done; long wait_now; cursor_on(); out_flush_cursor(FALSE, FALSE); ! for (done = 0; !got_int && done < msec; done += wait_now) { wait_now = msec - done > 1000L ? 1000L : msec - done; #ifdef FEAT_TIMERS --- 7675,7693 ---- void do_sleep(long msec) { ! long done = 0; 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(); out_flush_cursor(FALSE, FALSE); ! while (!got_int && done < msec) { wait_now = msec - done > 1000L ? 1000L : msec - done; #ifdef FEAT_TIMERS *************** *** 7700,7705 **** --- 7707,7713 ---- wait_now = 20L; #endif ui_delay(wait_now, TRUE); + #ifdef FEAT_JOB_CHANNEL if (has_any_channel()) ui_breakcheck_force(TRUE); *************** *** 7707,7717 **** #endif ui_breakcheck(); #ifdef MESSAGE_QUEUE ! /* Process the netbeans and clientserver messages that may have been ! * received in the call to ui_breakcheck() when the GUI is in use. This ! * may occur when running a test case. */ parse_queued_messages(); #endif } // If CTRL-C was typed to interrupt the sleep, drop the CTRL-C from the --- 7715,7733 ---- #endif ui_breakcheck(); #ifdef MESSAGE_QUEUE ! // Process the netbeans and clientserver messages that may have been ! // received in the call to ui_breakcheck() when the GUI is in use. This ! // may occur when running a test case. parse_queued_messages(); #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 *** ../vim-8.1.1852/src/version.c 2019-08-15 23:42:15.315873657 +0200 --- src/version.c 2019-08-16 10:21:46.250605534 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1853, /**/ -- I'm trying to be an optimist, but I don't think it'll work. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///