mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 06:48:17 +00:00
timer_pause: stop the timer resource (#8199)
If the timer isn't stopped, it still emits events which consume some CPU. Fix #8188
This commit is contained in:

committed by
Justin M. Keyes

parent
e54ff10d44
commit
f21867a15c
@@ -16861,6 +16861,12 @@ static void f_timer_pause(typval_T *argvars, typval_T *unused, FunPtr fptr)
|
||||
int paused = (bool)tv_get_number(&argvars[1]);
|
||||
timer_T *timer = pmap_get(uint64_t)(timers, tv_get_number(&argvars[0]));
|
||||
if (timer != NULL) {
|
||||
if (!timer->paused && paused) {
|
||||
time_watcher_stop(&timer->tw);
|
||||
} else if (timer->paused && !paused) {
|
||||
time_watcher_start(&timer->tw, timer_due_cb, timer->timeout,
|
||||
timer->timeout);
|
||||
}
|
||||
timer->paused = paused;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user