Results 1 to 5 of 5

Thread: Control the priority of QtConcurrent::run()?

  1. #1
    Join Date
    Aug 2008
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Control the priority of QtConcurrent::run()?

    Hi all,

    When using the QtConcurrent::run() function I don't see any way to control the priority of the thread on which the code executes. For other threading functions such as QThreadPool::start() and the QThread class it is possible to control this. Is there a reason why QtConcurrent omits this functionality? Any way to work around it?

    Thanks!

  2. #2
    Join Date
    Aug 2008
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Control the priority of QtConcurrent::run()?

    On further investigation I realise that priority is used in two different ways. QThread::setPriority() sets the amount of time the operating system will devote to that thread, whereas the priority passed to QThreadPool::start() simply controls the order in which the QRunnables are processed by the QThreadPool.

    So, further to my previous question, is it possible to set the operating system priority of the threads in a QThreadPool, or to have greater control over which Runnables are executed on which priority threads? I have some tasks which are background tasks and some where I want the results soon.

    Any ideas?

  3. #3
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Control the priority of QtConcurrent::run()?

    When working with thread , one must keep in mind that you can never assume anything.

    I would stuck to the Qt documentation and nothing else.

  4. #4
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    81
    Thanks
    6
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Control the priority of QtConcurrent::run()?

    i have the same problems, some weeks ago, and i can´t find the way to control the priority use QConcurrent framework.

    i have to use QThread directly, but i can use a QRunnable and QThreadPool approach.

    check the introduction to thread to more details http://www.ics.com/learning/icsnetwork/

  5. #5
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    81
    Thanks
    6
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Control the priority of QtConcurrent::run()?

    i have the same problems, some weeks ago, and i can´t find the way to control the priority use QConcurrent framework.

    i have to use QThread directly, but i can use a QRunnable and QThreadPool approach.

    check the introduction to thread to more details http://www.ics.com/learning/icsnetwork/

Similar Threads

  1. Qt thread priority
    By SailinShoes in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2010, 01:39
  2. Replies: 0
    Last Post: 16th December 2009, 09:45
  3. Error--High Priority
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2009, 16:14
  4. QtConcurrent
    By Brandybuck in forum An Introduction to QThreads
    Replies: 2
    Last Post: 9th May 2008, 14:10
  5. priority of QThread
    By quickNitin in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2006, 12:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.