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. General question on asynchronous programming

General question on asynchronous programming

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.2k Views 1 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.
  • D Offline
    D Offline
    ditto
    wrote on last edited by
    #1

    Hi,
    Though it is a general question, I am mostly encountering the issue while learnnig Qt.

    Let me give a simple example. Let's say I want to continue a process if and only if three mututally exclusive asynchronous processes (say, A, B and C) have succeeded. If anyone of them fails, I want to stop. If these three processes where not asynchronous, I could run them one after the other as make my decision to continue or not. however, this is not the case for the asynchronous processes A, B and C.

    What I would like to know is: "What is the standard design (or QT's) pattern of going about this?".

    I would appreciate an example or any external references to follow up on.

    Thanks.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t3685
      wrote on last edited by
      #2

      To be clear, are you talking about processes or threads?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        ditto
        wrote on last edited by
        #3

        Thanks for clarifying this. Looking at the documentation for QNetworkAccessManager, for example, Qt says "QNetworkAccessManager has an asynchronous API". I would rather use this definition just so to be within the context of Qt's best practices.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          t3685
          wrote on last edited by
          #4

          If you are talking abuot the asynchronous API of Qt classes, they usually emit signals that indicate success/fail.
          For example, QTcpSocket will emit a connected signal once a connection has been established.

          So if you're question is, how do I synchronize my code with Qt asynchronous function calls, my answer would be connect to the appropriate signals.

          1 Reply Last reply
          0

          • Login

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