setpriority impact on QProcess

738 views Asked by At

I have a C++/Qt5 program that sets the priority of the process using setpriority(). That process launches several executable programs using QProcess.

Will the programs launched by QProcess run at the NEW priority of the main process? Or does QProcess set their priority to 0?

1

There are 1 answers

3
Tatu Lahtela On

Are you talking about QProcesses or QThreads? QProcess doesn't have setPriority, but QThread::setPriority does. This affects pthread scheduling policy, which is by default inherited to child threads.

As for QProcess, at least in *nix it's a regular fork(), which preserves it's niceness value as it was during invocation time. So if you renice the main process, this value is passed to child processes.