One alternative would be for the parent application to wait for an event to be signaled by the multi-threaded child process when it has finished its initialization. The parent could use the MsgWaitForMultipleObjectsEx function to pump messages while waiting for the event to avoid making its UI unresponsive.
WaitForInputIdle
Hi everyone,
I'm working on a Windows C++ application where I need to wait for a multi-threaded process to finish processing its initial. I'm aware that WaitForInputIdle
from winuser.h
only waits for one thread in the target process to be idle, which isn't ideal for my scenario.
I'm looking for recommendations on alternative approaches or function to achieve this. Could you share your insights on the best approach for this scenario ?
Thanks in advance for your help!
2 answers
Sort by: Most helpful
-
-
2ourc3 0 Reputation points
2024-03-22T14:58:23.58+00:00 Thank you all for your answers. Apologies I didn't provided enough information in my initial post.
My goal is that the parent application launch an other application as a process, for example
notepad.exe
. Then once the remote process has finished processing the file input and is Idle, perform certain actions, for example close the remote process.If the remote process was a single-thread application then the
WaitForInputIdle
function would be sufficient but not for multi-threaded one