loop: remove children_stop_requests

It serves no purpose because process_stop() is already guarded by
`proc->stopped_time`.
This commit is contained in:
Justin M. Keyes
2018-04-13 22:27:00 +02:00
parent 7598e6cf17
commit c8f409c2f2
3 changed files with 6 additions and 13 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}