diff --git a/src/core/appcgroup.cpp b/src/core/appcgroup.cpp index 12d08ac..5a055cb 100644 --- a/src/core/appcgroup.cpp +++ b/src/core/appcgroup.cpp @@ -30,11 +30,7 @@ AppCGroup::AppCGroup(QObject *parent) QString AppCGroup::createProcessCGroup(const QString &appId, const QList &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();