View Full Version : Wait for multiple processes

23rd September 2012, 16:10
Hello everybody,

I have an application that provides GUI and depending on the user's preferences launches several instances of one computationally-intensive C++ (no Qt) console application. I need to wait for all instances to finish and then collect their results. My question is: how can I wait for e.g. 8 processes to end? I know that I can wait for one by connecting a signal ProcessTerminated to a slot of my app, but how to do it for 8 processes?

Any help is much appreciated.

23rd September 2012, 17:39
Use QProcess and in the slot connected to the finished() signal of each of those instances, reduce the counter for still active processes. Once it reaches 0, you're done.