From c8f409c2f297180ee06b474ef59653aebb817a4a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 13 Apr 2018 22:27:00 +0200 Subject: loop: remove `children_stop_requests` It serves no purpose because process_stop() is already guarded by `proc->stopped_time`. --- src/nvim/event/loop.c | 1 - src/nvim/event/loop.h | 1 - src/nvim/event/process.c | 17 ++++++----------- 3 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index d92464f17b..7998e0b8d0 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -21,7 +21,6 @@ void loop_init(Loop *loop, void *data) loop->recursive = 0; loop->uv.data = loop; loop->children = kl_init(WatcherPtr); - loop->children_stop_requests = 0; loop->events = multiqueue_new_parent(loop_on_put, loop); loop->fast_events = multiqueue_new_child(loop->events); loop->thread_events = multiqueue_new_parent(NULL, NULL); diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index d1a40d5cc9..c0e2f49e4f 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -37,7 +37,6 @@ typedef struct loop { // generic timer, used by loop_poll_events() uv_timer_t poll_timer; - size_t children_stop_requests; uv_async_t async; uv_mutex_t mutex; int recursive; diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 60650344ce..6820194d5e 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -228,13 +228,10 @@ void process_stop(Process *proc) FUNC_ATTR_NONNULL_ALL } Loop *loop = proc->loop; - if (!loop->children_stop_requests++) { - // When there's at least one stop request pending, start a timer that - // will periodically check if a signal should be send to the job. - ILOG("starting job kill timer"); - uv_timer_start(&loop->children_kill_timer, children_kill_cb, - KILL_TIMEOUT_MS, KILL_TIMEOUT_MS); - } + // Start a timer to periodically check if a signal should be send to the job. + ILOG("starting job kill timer"); + uv_timer_start(&loop->children_kill_timer, children_kill_cb, + KILL_TIMEOUT_MS, KILL_TIMEOUT_MS); } /// Iterates the process list sending SIGTERM to stopped processes and SIGKILL @@ -383,10 +380,8 @@ static void process_close_handles(void **argv) static void on_process_exit(Process *proc) { Loop *loop = proc->loop; - if (proc->stopped_time && loop->children_stop_requests - && !--loop->children_stop_requests) { - // Stop the timer if no more stop requests are pending - DLOG("Stopping process kill timer"); + if (proc->stopped_time) { + DLOG("stopping process kill timer"); uv_timer_stop(&loop->children_kill_timer); } -- cgit