summaryrefslogtreecommitdiffstats
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-06-17 15:17:10 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-17 15:17:10 +0100
commit616592e0816d2d9f893fcd95e3e1e0fbc5893168 (patch)
treef832a0c1dbe16fcbd944e4b735829279e75ea49d /src/os_unix.c
parent5ea38d1e7fd597ffde13b292d43e12747f20e97f (diff)
patch 8.2.5115: search timeout is overrun with some patternsv8.2.5115
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.
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 6fd24508dd..083fd8f9be 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -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 = {