[igt-dev] [PATCH i-g-t v33 37/39] lib/intel_allocator: drop kill_children()

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Apr 13 08:42:24 UTC 2021


Use igt_waitchildren_timeout() instead of custom kill_children()
function to avoid killing handlers (hang, ...)

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 lib/intel_allocator.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c
index 6298a5a20..0b33b8b24 100644
--- a/lib/intel_allocator.c
+++ b/lib/intel_allocator.c
@@ -715,16 +715,6 @@ static int handle_request(struct alloc_req *req, struct alloc_resp *resp)
 	return ret;
 }
 
-static void kill_children(int sig)
-{
-	sighandler_t old;
-
-	old = signal(sig, SIG_IGN);
-	igt_assert(old != SIG_ERR);
-	kill(-getpgrp(), sig);
-	igt_assert(signal(sig, old) != SIG_ERR);
-}
-
 static void *allocator_thread_loop(void *data)
 {
 	struct alloc_req req;
@@ -744,7 +734,7 @@ static void *allocator_thread_loop(void *data)
 		if (ret == -1) {
 			igt_warn("Error receiving request in thread, ret = %d [%s]\n",
 				 ret, strerror(errno));
-			kill_children(SIGINT);
+			igt_waitchildren_timeout(1, "Stopping children, error receiving request\n");
 			return (void *) -1;
 		}
 
@@ -766,7 +756,7 @@ static void *allocator_thread_loop(void *data)
 			igt_warn("Error sending response in thread, ret = %d [%s]\n",
 				 ret, strerror(errno));
 
-			kill_children(SIGINT);
+			igt_waitchildren_timeout(1, "Stopping children, error sending response\n");
 			return (void *) -1;
 		}
 	}
@@ -858,7 +848,6 @@ void intel_allocator_multiprocess_stop(void)
 		pthread_join(allocator_thread, NULL);
 
 		/* But we're not sure does child will stuck */
-		kill_children(SIGINT);
 		igt_waitchildren_timeout(5, "Stopping children");
 		multiprocess = false;
 	}
-- 
2.26.0



More information about the igt-dev mailing list