CPUUsage: don't hang on weird host

Try fixing CI of FreeBSD
This commit is contained in:
李通洲
2023-11-01 15:26:24 +08:00
parent 5a699af610
commit 6e816fca6e
+3
View File
@@ -27,6 +27,7 @@ const char* ffGetCpuUsageResult(FFlist* result)
if(cpuTimes1.length == 0) return "No CPU cores found";
FF_LIST_AUTO_DESTROY cpuTimes2 = ffListCreate(sizeof(FFCpuUsageInfo));
uint32_t retryCount = 0;
retry:
error = ffGetCpuUsageInfo(&cpuTimes2);
@@ -41,6 +42,8 @@ retry:
{
ffListClear(&cpuTimes2);
ffTimeSleep(200);
if (++retryCount >= 10)
return "Retry count exceeded";
goto retry;
}
}