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. [SOLVED]How to ensure QtConcurrent::run ( Function function, ... ) always runs
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]How to ensure QtConcurrent::run ( Function function, ... ) always runs

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k 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.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    As per Qt doc,
    @QFuture<T> QtConcurrent::run ( Function function, ... )
    Runs function in a separate thread. The thread is taken from the global QThreadPool. Note that the function may not run immediately; the function will only be run when a thread is available.@

    And i doubt, sometimes even function is not called at all. Is there any way to ensure that function is always called by reserving thread before calling run().

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

      Hi,

      I think the better way is to sub-class "QThread":http://qt-project.org/doc/qt-4.8/qthread.html and make your own management.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        adnan
        wrote on last edited by
        #3

        The problem was with my code. QtConcurrent::run() always calls the function, once thread is available.

        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