From ab0bd716ccdc31ce10b0682be1224914d4b8e443 Mon Sep 17 00:00:00 2001 From: AlexandraTrifan Date: Tue, 28 Mar 2023 16:25:33 +0300 Subject: [PATCH] DeviceGeneric.cpp: If the previous call failed, allow more time to settle. Failure means that the buffer was not yet destroyed, so the next call will probably fail as well if we don't delay the process. Signed-off-by: AlexandraTrifan --- src/utils/devicegeneric.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/devicegeneric.cpp b/src/utils/devicegeneric.cpp index 06c91d22..bf9341c1 100644 --- a/src/utils/devicegeneric.cpp +++ b/src/utils/devicegeneric.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace std; using namespace libm2k::utils; @@ -644,6 +645,9 @@ void DeviceGeneric::setKernelBuffersCount(unsigned int count) retry++; if (ret != -EBUSY) { ok = true; + } else { + // If the call failed, allow more time to settle + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } } if (ret != 0) {