Results 1 to 2 of 2

Thread: Wait for multiple processes

  1. #1
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Qt products
    Qt4

    Default Wait for multiple processes

    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.
    Daniel

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Wait for multiple processes

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    Eubie (23rd September 2012)

Similar Threads

  1. Wait Condition Indication to User Using Loading/Wait Message
    By vivek.panchal in forum Qt Programming
    Replies: 4
    Last Post: 14th August 2012, 16:40
  2. QUdpSocket broadcast to multiple processes
    By tomschuring in forum Qt Programming
    Replies: 1
    Last Post: 30th September 2010, 01:33
  3. Display from multiple processes in one GUI
    By abernat in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2009, 20:08
  4. QProcess Bash in Event Filter (Multiple Processes)
    By Arsenic in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2008, 08:42
  5. Enumerate processes using Qt
    By Ben.Hines in forum Qt Programming
    Replies: 5
    Last Post: 14th February 2006, 15:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.