From b003080265399233aad7de08327e25513ccc9ebc Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 8 Jan 2024 20:09:31 +0100 Subject: Kill children --- src/AsyncImageLoader.cpp | 2 +- src/Downloader.cpp | 8 ++++---- src/Program.cpp | 6 +++--- src/VideoPlayer.cpp | 2 +- video_player/src/main.cpp | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp index 2b454da..1118ee6 100644 --- a/src/AsyncImageLoader.cpp +++ b/src/AsyncImageLoader.cpp @@ -398,7 +398,7 @@ namespace QuickMedia { void AsyncImageLoader::reset_download(Download &download) { std::lock_guard lock(download_mutex); if(download.read_program.pid != -1) { - kill(download.read_program.pid, SIGTERM); + kill(download.read_program.pid, SIGKILL); int status; waitpid(download.read_program.pid, &status, 0); download.read_program.pid = -1; diff --git a/src/Downloader.cpp b/src/Downloader.cpp index 2c0d316..14580bb 100644 --- a/src/Downloader.cpp +++ b/src/Downloader.cpp @@ -81,7 +81,7 @@ namespace QuickMedia { if(read_program.read_fd != -1) close(read_program.read_fd); if(read_program.pid != -1) { - kill(read_program.pid, SIGTERM); + kill(read_program.pid, SIGKILL); int status; waitpid(read_program.pid, &status, 0); } @@ -273,7 +273,7 @@ namespace QuickMedia { if(read_program_file) fclose(read_program_file); if(read_program.pid != -1) { - kill(read_program.pid, SIGTERM); + kill(read_program.pid, SIGKILL); int status; waitpid(read_program.pid, &status, 0); } @@ -326,7 +326,7 @@ namespace QuickMedia { static int64_t seek_fn(YoutubeReadProgram *program, int64_t offset) { if(program->read_program.pid != -1) { - kill(program->read_program.pid, SIGTERM); + kill(program->read_program.pid, SIGKILL); int status; waitpid(program->read_program.pid, &status, 0); program->read_program.pid = -1; @@ -387,7 +387,7 @@ namespace QuickMedia { static void close_fn(YoutubeReadProgram *program) { if(program->read_program.pid != -1) { - kill(program->read_program.pid, SIGTERM); + kill(program->read_program.pid, SIGKILL); int status; waitpid(program->read_program.pid, &status, 0); program->read_program.pid = -1; diff --git a/src/Program.cpp b/src/Program.cpp index de30e4f..70ac6e0 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -96,7 +96,7 @@ public: it->second.program.write_fd = -1; } if(it->second.program.pid != -1) { - kill(it->second.program.pid, SIGTERM); + kill(it->second.program.pid, SIGKILL); int status; waitpid(it->second.program.pid, &status, 0); it->second.program.pid = -1; @@ -272,7 +272,7 @@ int exec_program_write_stdin(const char **args, const char *str, size_t size, Pr // TODO: Set program.pid to -1 and with currenthreadprogram mutex. Same in other places if(result != 0) - kill(program.pid, SIGTERM); + kill(program.pid, SIGKILL); if(waitpid(program.pid, &status, 0) == -1) { perror("waitpid failed"); @@ -344,7 +344,7 @@ int exec_program(const char **args, ProgramOutputCallback output_callback, void } if(result != 0) - kill(read_program.pid, SIGTERM); + kill(read_program.pid, SIGKILL); if(waitpid(read_program.pid, &status, 0) == -1) { perror("waitpid failed"); diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 26946fc..4642855 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -116,7 +116,7 @@ namespace QuickMedia { VideoPlayer::~VideoPlayer() { if(video_process_id != -1) { - kill(video_process_id, SIGTERM); + kill(video_process_id, SIGKILL); wait_program(video_process_id); } diff --git a/video_player/src/main.cpp b/video_player/src/main.cpp index c80cf9a..0342b45 100644 --- a/video_player/src/main.cpp +++ b/video_player/src/main.cpp @@ -427,7 +427,7 @@ static int64_t size_fn(void *cookie) { } if(res != 0) - kill(header_program.pid, SIGTERM); + kill(header_program.pid, SIGKILL); int status = 0; if(waitpid(header_program.pid, &status, 0) == -1) { @@ -493,7 +493,7 @@ static int64_t seek_fn(void *cookie, int64_t offset) { ReadProgram *program = (ReadProgram*)cookie; if(program->pid != -1) { - kill(program->pid, SIGTERM); + kill(program->pid, SIGKILL); int status; waitpid(program->pid, &status, 0); program->pid = -1; @@ -548,7 +548,7 @@ static void close_fn(void *cookie) { ReadProgram *program = (ReadProgram*)cookie; if(program->pid != -1) { - kill(program->pid, SIGTERM); + kill(program->pid, SIGKILL); int status; waitpid(program->pid, &status, 0); program->pid = -1; -- cgit v1.2.3