Added small sleep after reading pipe.

This commit is contained in:
Nffj84
2024-07-03 18:40:13 +03:00
parent f77e2d3661
commit a14e463989
+7
View File
@@ -251,6 +251,7 @@ void RemoteControl::run()
ssize_t bytesRead = read(mFifoFdIn, buffer, sizeof(buffer) - 1);
if (bytesRead > 0) {
mIsBusy = true;
buffer[bytesRead] = '\0';
QJsonDocument commandDoc = QJsonDocument::fromJson(buffer);
@@ -261,6 +262,7 @@ void RemoteControl::run()
// Ignore own messages and messages that don't have sender
if (commandObject.contains("sender") == false || commandObject["sender"] == FIFO_WHO_AM_I) {
mIsBusy = false;
continue;
}
@@ -305,10 +307,15 @@ void RemoteControl::run()
Config::updateState();
QTimer::singleShot(0, this, [this, commandObject]() mutable { turnToTarget(commandObject); });
} else {
mIsBusy = false;
}
} else {
mIsBusy = false;
}
}
QCoreApplication::processEvents();
QThread::msleep(100);
}
}