PDA

View Full Version : How to wait for a process that may not have started yet?



khannu
2nd September 2013, 09:04
Hello,

I am using Qt3, and am still new to Qt.

I start Process # 1 and have connected its processExited to firing up Process # 2, and connected its processExited to firing up Process # 3.

So, in effect, the three processes are daisy-chained together.

I want to wait until Process # 3 is completed, and then carry on with the remainder of the main program.

What is the best way to do this, considering that when I am starting Process # 1, I have no certainty when - or if - Process # 3 will start.


Thanks,
Nadeem

wysota
2nd September 2013, 22:49
It should be enough to connect to the processExited signal of process 3, however bear in mind that any of the previous process might have failed and Process #3 might not have accomplished its task. It is better to connect a implement some kind of state machine that will do all the checks for you and will emit proper signals. Then you can connect to an appropriate signal of the state machine object to be sure that your slot fires only when all three processes had been successful.