0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.5115: search timeout is overrun with some patterns

Problem:    Search timeout is overrun with some patterns.
Solution:   Check for timeout in more places.  Make the flag volatile and
            atomic.  Use assert_inrange() to see what happened.
This commit is contained in:
Bram Moolenaar
2022-06-17 15:17:10 +01:00
parent 5ea38d1e7f
commit 616592e081
7 changed files with 80 additions and 37 deletions

View File

@@ -8251,7 +8251,7 @@ xsmp_close(void)
/*
* Implement timeout with timer_create() and timer_settime().
*/
static int timeout_flag = FALSE;
static volatile int timeout_flag = FALSE;
static timer_t timer_id;
static int timer_created = FALSE;
@@ -8296,7 +8296,7 @@ stop_timeout(void)
* This function is not expected to fail, but if it does it will still return a
* valid flag pointer; the flag will remain stuck as FALSE .
*/
const int *
volatile int *
start_timeout(long msec)
{
struct itimerspec interval = {
@@ -8324,6 +8324,8 @@ start_timeout(long msec)
timer_created = TRUE;
}
ch_log(NULL, "setting timeout timer to %d sec %ld nsec",
(int)interval.it_value.tv_sec, (long)interval.it_value.tv_nsec);
ret = timer_settime(timer_id, 0, &interval, NULL);
if (ret < 0)
semsg(_(e_could_not_set_timeout_str), strerror(errno));
@@ -8351,7 +8353,7 @@ delete_timer(void)
*/
static struct itimerval prev_interval;
static struct sigaction prev_sigaction;
static int timeout_flag = FALSE;
static volatile int timeout_flag = FALSE;
static int timer_active = FALSE;
static int timer_handler_active = FALSE;
static int alarm_pending = FALSE;
@@ -8409,7 +8411,7 @@ stop_timeout(void)
* This function is not expected to fail, but if it does it will still return a
* valid flag pointer; the flag will remain stuck as FALSE .
*/
const int *
volatile int *
start_timeout(long msec)
{
struct itimerval interval = {