后台dbus通信修改为同步调用

This commit is contained in:
guopengfei 2023-08-23 13:38:41 +08:00
parent 3b933a87db
commit 747d8495b2
1 changed files with 2 additions and 9 deletions

View File

@ -30,11 +30,7 @@ AppCGroup::AppCGroup(QObject *parent)
QString AppCGroup::createProcessCGroup(const QString &appId, const QList<int> &pids)
{
auto reply = m_processManagerInterface->CreateProcessCGroup(appId, pids);
qDebug() << "reply is finished. " << reply.isFinished();
while (!reply.isFinished()) {
qApp->processEvents();
usleep(10);
}
reply.waitForFinished();
if (reply.isError()) {
qWarning() << "createProcessCGroup error, " << reply.error();
return QString();
@ -76,10 +72,7 @@ bool AppCGroup::reclaimProcesses(const QString &cgroupName)
QString AppCGroup::cgroupNameWithPid(int pid)
{
auto reply = m_processManagerInterface->CGroupNameWithPid(pid);
while (!reply.isFinished()) {
qApp->processEvents();
usleep(1);
}
reply.waitForFinished();
if (reply.isError()) {
qWarning() << __FUNCTION__ << "error, " << reply.error();
return QString();