To: vim_dev@googlegroups.com Subject: Patch 8.1.0844 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0844 Problem: When timer fails test will hang forever. Solution: Use reltime() to limit waiting time. (Ozaki Kiichi, closes #3878) Files: src/testdir/test_timers.vim *** ../vim-8.1.0843/src/testdir/test_timers.vim 2019-01-28 23:20:00.407634900 +0100 --- src/testdir/test_timers.vim 2019-01-29 20:34:41.123382637 +0100 *************** *** 257,265 **** return endif let id = timer_start(20, {id -> feedkeys('x', 'L')}) let c = 0 ! while c == 0 let c = getchar(0) sleep 10m endwhile --- 257,267 ---- return endif + " Measure the elapsed time to avoid a hang when it fails. + let start = reltime() let id = timer_start(20, {id -> feedkeys('x', 'L')}) let c = 0 ! while c == 0 && reltimefloat(reltime(start)) < 0.2 let c = getchar(0) sleep 10m endwhile *** ../vim-8.1.0843/src/version.c 2019-01-29 20:17:25.554548212 +0100 --- src/version.c 2019-01-29 20:36:10.118765845 +0100 *************** *** 785,786 **** --- 785,788 ---- { /* Add new patch number below this line */ + /**/ + 844, /**/ -- ARTHUR: You fight with the strength of many men, Sir knight. I am Arthur, King of the Britons. [pause] I seek the finest and the bravest knights in the land to join me in my Court of Camelot. [pause] You have proved yourself worthy; will you join me? [pause] You make me sad. So be it. Come, Patsy. BLACK KNIGHT: None shall pass. The Quest for the Holy Grail (Monty Python) /// 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 ///