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
Forum Updated to NodeBB v4.3 + New Features

runtime error and QFuture

Scheduled Pinned Locked Moved Solved General and Desktop
qfutureqtconcurrent
4 Posts 2 Posters 1.4k 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 12 Feb 2018, 08:43 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!

    V 1 Reply Last reply 12 Feb 2018, 09:00
    0
    • S scottnat
      12 Feb 2018, 08:43

      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!

      V Offline
      V Offline
      VRonin
      wrote on 12 Feb 2018, 09:00 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 14 Feb 2018, 07:41
      2
      • S Offline
        S Offline
        scottnat
        wrote on 14 Feb 2018, 07:38 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • V VRonin
          12 Feb 2018, 09:00

          @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 14 Feb 2018, 07:41 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

          1/4

          12 Feb 2018, 08:43

          • Login

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