Important: Please read the Qt Code of Conduct -

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

  • 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().

  • Hi,

    I think the better way is to sub-class "QThread": and make your own management.

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

Log in to reply