forked from aniani/vim
patch 8.2.5131: timeout implementation is not optimal
Problem: Timeout implementation is not optimal.
Solution: Further improvements for timeouts. Add a test for searchpair()
timeout. (partly by Paul Ollis)
This commit is contained in:
6
src/auto/configure
vendored
6
src/auto/configure
vendored
@@ -4769,6 +4769,8 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||||||
MACOS_X_DARWIN=yes
|
MACOS_X_DARWIN=yes
|
||||||
OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
|
OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
|
||||||
OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
|
OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
|
||||||
|
$as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
|
CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
|
||||||
|
|
||||||
if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
|
if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
|
||||||
@@ -13044,7 +13046,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|||||||
|
|
||||||
#include<signal.h>
|
#include<signal.h>
|
||||||
#include<time.h>
|
#include<time.h>
|
||||||
static void set_flag(union sigval) {}
|
static void set_flag(union sigval sv) {}
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
@@ -13073,7 +13075,7 @@ else
|
|||||||
|
|
||||||
#include<signal.h>
|
#include<signal.h>
|
||||||
#include<time.h>
|
#include<time.h>
|
||||||
static void set_flag(union sigval) {}
|
static void set_flag(union sigval sv) {}
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
|
|||||||
@@ -287,6 +287,8 @@ if test "$vim_cv_uname_output" = Darwin; then
|
|||||||
MACOS_X_DARWIN=yes
|
MACOS_X_DARWIN=yes
|
||||||
OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
|
OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
|
||||||
OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
|
OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
|
||||||
|
dnl os_macosx.m implements timer_create() and friends
|
||||||
|
AC_DEFINE(HAVE_TIMER_CREATE)
|
||||||
dnl TODO: use -arch i386 on Intel machines
|
dnl TODO: use -arch i386 on Intel machines
|
||||||
dnl Removed -no-cpp-precomp, only for very old compilers.
|
dnl Removed -no-cpp-precomp, only for very old compilers.
|
||||||
CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
|
CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
|
||||||
@@ -3809,7 +3811,7 @@ LIBS="$LIBS -lrt"
|
|||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||||
#include<signal.h>
|
#include<signal.h>
|
||||||
#include<time.h>
|
#include<time.h>
|
||||||
static void set_flag(union sigval) {}
|
static void set_flag(union sigval sv) {}
|
||||||
], [
|
], [
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct sigevent action = {0};
|
struct sigevent action = {0};
|
||||||
@@ -3824,7 +3826,7 @@ static void set_flag(union sigval) {}
|
|||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||||
#include<signal.h>
|
#include<signal.h>
|
||||||
#include<time.h>
|
#include<time.h>
|
||||||
static void set_flag(union sigval) {}
|
static void set_flag(union sigval sv) {}
|
||||||
], [
|
], [
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct sigevent action = {0};
|
struct sigevent action = {0};
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ endfunc
|
|||||||
func Test_hlsearch_hangs()
|
func Test_hlsearch_hangs()
|
||||||
CheckFunction reltimefloat
|
CheckFunction reltimefloat
|
||||||
|
|
||||||
" So, it turns out the Windows 7 implements TimerQueue timers differently
|
" So, it turns out that Windows 7 implements TimerQueue timers differently
|
||||||
" and they can expire *before* the requested time has elapsed. So allow for
|
" and they can expire *before* the requested time has elapsed. So allow for
|
||||||
" the timeout occurring after 80 ms (5 * 16 (the typical clock tick)).
|
" the timeout occurring after 80 ms (5 * 16 (the typical clock tick)).
|
||||||
if has("win32")
|
if has("win32")
|
||||||
|
|||||||
@@ -355,6 +355,37 @@ func Test_searchpair_timeout()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func SearchpairSkip()
|
||||||
|
let id = synID(line('.'), col('.'), 0)
|
||||||
|
let attr = synIDattr(id, 'name')
|
||||||
|
return attr !~ 'comment'
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_searchpair_timeout_with_skip()
|
||||||
|
let g:test_is_flaky = 1
|
||||||
|
|
||||||
|
edit ../evalfunc.c
|
||||||
|
if has('win32')
|
||||||
|
" Windows timeouts are rather coarse grained, about 16ms.
|
||||||
|
let ms = 20
|
||||||
|
let min_time = 0.016
|
||||||
|
let max_time = min_time * 10.0
|
||||||
|
else
|
||||||
|
let ms = 1
|
||||||
|
let min_time = 0.001
|
||||||
|
let max_time = min_time * 10.0
|
||||||
|
if GetVimCommand() =~ 'valgrind.*--log-file='
|
||||||
|
let max_time += 0.04 " this can be slow with valgrind
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let start = reltime()
|
||||||
|
let found = searchpair('(', '', ')', 'crnm', 'SearchpairSkip()', 0, ms)
|
||||||
|
let elapsed = reltimefloat(reltime(start))
|
||||||
|
call assert_inrange(min_time, max_time, elapsed)
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_searchpairpos()
|
func Test_searchpairpos()
|
||||||
new
|
new
|
||||||
call setline(1, ['other code', 'here [', ' [', ' " cursor here', ' ]]'])
|
call setline(1, ['other code', 'here [', ' [', ' " cursor here', ' ]]'])
|
||||||
|
|||||||
@@ -734,6 +734,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 */
|
||||||
|
/**/
|
||||||
|
5131,
|
||||||
/**/
|
/**/
|
||||||
5130,
|
5130,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user