Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Set the priority of a process



  • Hello everyone! I am creating a GUI for a program.
    So what I do is run a command QProcess specially configured.
    I wish I could set the priority of this process that launch, I tried using this:
    [code]QThread::currentThread()->setPriority(QThread::HighestPriority);[/code]
    but does not work (I'm using linux), also fear that the process launched by QProcess septa already a priority, if it did, I would be able to overwrite.
    thank you very much.

    ps: I would like a command that would work for all operating systems


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, no, however since 5.3 you have
    @qint64 QProcess::processId() const@
    which returns the native process id. You might be able to modify its priority through platform specific code.

    Hope it helps


Log in to reply