From 09d29cca5a7b848a19351e0df1af479ca7a155a3 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 2 Feb 2023 00:25:53 +0900 Subject: [PATCH] pluginloader-win32: Watch child process handle on connection ... so that parent can avoid waiting if child process got terminated unexpectedly Part-of: --- subprojects/gstreamer/gst/gstpluginloader-win32.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subprojects/gstreamer/gst/gstpluginloader-win32.c b/subprojects/gstreamer/gst/gstpluginloader-win32.c index ffab8386c1..da22540379 100644 --- a/subprojects/gstreamer/gst/gstpluginloader-win32.c +++ b/subprojects/gstreamer/gst/gstpluginloader-win32.c @@ -281,6 +281,7 @@ gst_plugin_loader_try_helper (GstPluginLoader * self, gchar * location) DWORD n_bytes; DWORD wait_ret; gchar *pipe_name = NULL; + HANDLE waitables[2]; memset (&si, 0, sizeof (STARTUPINFOW)); si.cb = sizeof (STARTUPINFOW); @@ -347,7 +348,9 @@ gst_plugin_loader_try_helper (GstPluginLoader * self, gchar * location) } /* Wait for client connection */ - wait_ret = WaitForSingleObjectEx (loader->overlap.hEvent, 5000, TRUE); + waitables[0] = loader->overlap.hEvent; + waitables[1] = self->child_info.hProcess; + wait_ret = WaitForMultipleObjectsEx (2, waitables, FALSE, 5000, TRUE); if (wait_ret == WAIT_OBJECT_0) { ret = GetOverlappedResult (loader->pipe, &loader->overlap, &n_bytes, FALSE); if (!ret) {