Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Checking if application is still live?

Checking if application is still live?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 522 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I have an application that launches other applications, I pass the child applications the PID of the launching application via the command line.

    I want the child application to check if the launching application is still live by checking if the PID is still active. Is there a function to do this in Qt? I know that QProcess can check the applications own PID, but is there a facility to do this for another?

    Kind Regards,
    Sy

    1 Reply Last reply
    0
    • SPlattenS SPlatten

      @SGaist , the main (launching) application is the application engine, it reads the modules that it will launch from an XML configuration file. The modules provide additional functionality that isn't in the engine, for example file I/O or database access. These modules are slaves to the main application, the main application issues requests to the applications and the child modules respond.

      When the main application is terminated I want the child modules to terminate themselves, originally I thought of issuing a message from the main application however this doesn't work if for some reason the main application dies or is terminated so I thought each module could check if the main application is still up and running...I could also do this by sending a message from the modules, which I already do as each module issues a heartbeat message to the launcher to notify it that the module is still up and running....I might just make the main application send an 'ack' in response to receiving a heartbeat and then the module could terminate if it doesn't receive a heartbeat in a timely manor.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #6

      @SPlatten said in Checking if application is still live?:

      When the main application is terminated I want the child modules to terminate themselves

      For the record, that's exactly what QProcess::start() will cause. In a robust fashion, if they don't acknowledge. If that's all you want the heartbeat for.

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        I am not aware of such a functionality out of the box.

        Out of curiosity, can you explain why the child application needs to check that ? This might help finding a good solution.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        SPlattenS 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          I am not aware of such a functionality out of the box.

          Out of curiosity, can you explain why the child application needs to check that ? This might help finding a good solution.

          SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #3

          @SGaist , the main (launching) application is the application engine, it reads the modules that it will launch from an XML configuration file. The modules provide additional functionality that isn't in the engine, for example file I/O or database access. These modules are slaves to the main application, the main application issues requests to the applications and the child modules respond.

          When the main application is terminated I want the child modules to terminate themselves, originally I thought of issuing a message from the main application however this doesn't work if for some reason the main application dies or is terminated so I thought each module could check if the main application is still up and running...I could also do this by sending a message from the modules, which I already do as each module issues a heartbeat message to the launcher to notify it that the module is still up and running....I might just make the main application send an 'ack' in response to receiving a heartbeat and then the module could terminate if it doesn't receive a heartbeat in a timely manor.

          Kind Regards,
          Sy

          JonBJ 1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            A bidirectional heart beat is a good solution.

            I have implemented something like that using ZMQ which works nicely and is platform independent.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            SPlattenS 1 Reply Last reply
            3
            • SGaistS SGaist

              A bidirectional heart beat is a good solution.

              I have implemented something like that using ZMQ which works nicely and is platform independent.

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #5

              @SGaist , Thank you, I'll give it a go.

              Kind Regards,
              Sy

              1 Reply Last reply
              0
              • SPlattenS SPlatten

                @SGaist , the main (launching) application is the application engine, it reads the modules that it will launch from an XML configuration file. The modules provide additional functionality that isn't in the engine, for example file I/O or database access. These modules are slaves to the main application, the main application issues requests to the applications and the child modules respond.

                When the main application is terminated I want the child modules to terminate themselves, originally I thought of issuing a message from the main application however this doesn't work if for some reason the main application dies or is terminated so I thought each module could check if the main application is still up and running...I could also do this by sending a message from the modules, which I already do as each module issues a heartbeat message to the launcher to notify it that the module is still up and running....I might just make the main application send an 'ack' in response to receiving a heartbeat and then the module could terminate if it doesn't receive a heartbeat in a timely manor.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #6

                @SPlatten said in Checking if application is still live?:

                When the main application is terminated I want the child modules to terminate themselves

                For the record, that's exactly what QProcess::start() will cause. In a robust fashion, if they don't acknowledge. If that's all you want the heartbeat for.

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved