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. runtime error and QFuture
QtWS25 Last Chance

runtime error and QFuture

Scheduled Pinned Locked Moved Solved General and Desktop
qfutureqtconcurrent
4 Posts 2 Posters 1.3k Views
  • 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.
  • S Offline
    S Offline
    scottnat
    wrote on last edited by
    #1

    Hello guys. I am still learning Qt C++ and I have a lot of code, so I will try and explain my problem in point form as best as I can. Please bear with me.

    • I have two objects of a class.

    • From my MainWindow.cpp i connect signals and slots to these two objects functions, where data is processed and results are emitted back to my main MainWindow.

    • Two QFutures are created using each of those class objects. They are ran by using QFuture<void> futureEg1 = QtConcurrent::run( &object, &ClassName::function, args...)

    • All is good till this point, I am able to process my data and retrieve it in my main thread for both objects.

    • At the moment, in my main thread's slot that receives the data, I am only qDebugging the results. No modifications or other access, as I'm afraid of data being unsynchronised or something?

    Is there be a problem when two signals emit the same slot at the same time in my main thread, as I have encountered a runtime error.

    Thanks and if you need me to clarify or show the relevant parts of the code, anything I will most definitely do so. Your help is of utmost appreciation!

    VRoninV 1 Reply Last reply
    0
    • S scottnat

      Hello guys. I am still learning Qt C++ and I have a lot of code, so I will try and explain my problem in point form as best as I can. Please bear with me.

      • I have two objects of a class.

      • From my MainWindow.cpp i connect signals and slots to these two objects functions, where data is processed and results are emitted back to my main MainWindow.

      • Two QFutures are created using each of those class objects. They are ran by using QFuture<void> futureEg1 = QtConcurrent::run( &object, &ClassName::function, args...)

      • All is good till this point, I am able to process my data and retrieve it in my main thread for both objects.

      • At the moment, in my main thread's slot that receives the data, I am only qDebugging the results. No modifications or other access, as I'm afraid of data being unsynchronised or something?

      Is there be a problem when two signals emit the same slot at the same time in my main thread, as I have encountered a runtime error.

      Thanks and if you need me to clarify or show the relevant parts of the code, anything I will most definitely do so. Your help is of utmost appreciation!

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @scottnat said in runtime error and QFuture:

      Is there be a problem when two signals emit the same slot at the same time in my main thread

      No, unless you force Qt::DirectConnection

      as I have encountered a runtime error

      Post stack trace please

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      S 1 Reply Last reply
      2
      • S Offline
        S Offline
        scottnat
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • VRoninV VRonin

          @scottnat said in runtime error and QFuture:

          Is there be a problem when two signals emit the same slot at the same time in my main thread

          No, unless you force Qt::DirectConnection

          as I have encountered a runtime error

          Post stack trace please

          S Offline
          S Offline
          scottnat
          wrote on last edited by
          #4

          @VRonin
          Hi, thanks VRonin for the reply. Turns out the problem was to do with the library of FFTW that I used.

          I used separate threads to run functions from that library, which apparently are not thread safe. However, even with mutex locks they still wouldn't work. Back to the drawing board.

          Thanks.

          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