如何强制优先考虑QProcess

时间:2012-07-05 07:27:30

标签: linux qt qprocess

我没有看到任何API来设置Qt文档中QProcess的优先级。我假设该过程以正常优先级启动。

有没有办法在Linux上以较低优先级启动进程?

2 个答案:

答案 0 :(得分:2)

重载QProcess::setupChildProcess()并写一些关于:

的内容
void QtvProcess::setupChildProcess()
{
#if defined Q_OS_UNIX
    if (::nice(5) == -1) // default: +5
        perror("nice");
#endif
}

答案 1 :(得分:0)

我不认为存在使用Qt调用设置进程优先级的API。我使用直接Linux调用,并成功地能够更改进程优先级。 请参阅:http://pubs.opengroup.org/onlinepubs/009696699/functions/setpriority.html