linux - 如何强制 QProcess 优先级

标签 linux qt qprocess

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

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

最佳答案

重载QProcess::setupChildProcess()并编写一些内容:

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

关于linux - 如何强制 QProcess 优先级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11339643/

相关文章:

java - Jar 文件无法运行,提取的类运行正常

linux - 将数据文件包装到 golang 应用程序并在 exec 中使用

c++ - 如何在 Qt 中 sleep /暂停?

Qt5 - 如何让 qurl 检测给定的 url 是否是本地的,如果不是,则添加 "http://"?

c++ - QProcess with non-wrapped pipe symbol |在参数列表中

linux - 将相应站点的值导出到新的文本文件

linux - 寻找在 Linux 中编辑大文件的快速方法

c++ - Qt 如何处理信号和槽的引用调用?

c++ - QProcess 无法传递参数

c++ - 暂停和恢复由 Qt 中的 QProcess 启动的子进程