1
0
forked from aniani/vim

patch 8.2.5057: using gettimeofday() for timeout is very inefficient

Problem:    Using gettimeofday() for timeout is very inefficient.
Solution:   Set a platform dependent timer. (Paul Ollis, closes #10505)
This commit is contained in:
Paul Ollis
2022-06-05 16:55:54 +01:00
committed by Bram Moolenaar
parent 1d97db3d98
commit 6574577cac
29 changed files with 811 additions and 242 deletions

View File

@@ -1,7 +1,8 @@
dnl configure.ac: autoconf script for Vim
dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
dnl Should also work with autoconf 2.54 and later.
dnl Process this file with autoconf 2.69 to produce "configure".
dnl This should also work with other versions of autoconf, but 2.70 and later
dnl generate lots of hard to fix "obsolete" warnings.
AC_INIT(vim.h)
AC_CONFIG_HEADER(auto/config.h:config.h.in)
@@ -3812,6 +3813,41 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
AC_MSG_RESULT(no))
dnl Check for timer_create. It probably requires the 'rt' library.
AC_MSG_CHECKING([for timer_create])
save_LIBS="$LIBS"
LIBS="$LIBS -lrt"
AC_TRY_LINK([
#include<signal.h>
#include<time.h>
static void set_flag(union sigval) {}
], [
struct timespec ts;
struct sigevent action = {0};
timer_t timer_id;
action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag;
timer_create(CLOCK_REALTIME, &action, &timer_id);
],
AC_MSG_RESULT(yes; with -lrt); AC_DEFINE(HAVE_TIMER_CREATE),
LIBS="$save_LIBS"
AC_TRY_LINK([
#include<signal.h>
#include<time.h>
static void set_flag(union sigval) {}
], [
struct timespec ts;
struct sigevent action = {0};
timer_t timer_id;
action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag;
timer_create(CLOCK_REALTIME, &action, &timer_id);
],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMER_CREATE),
AC_MSG_RESULT(no)))
AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[