Replace usleep with util::sleep_for (#19643)

* replace usleep with sleep_for

* sleep microseconds

* sleep nanoseconds

* Trigger Build
old-commit-hash: c1cf0882bd4e0fce5e1a581536f6a0e7afb640e6
This commit is contained in:
Dean Lee
2021-01-05 01:03:11 +08:00
committed by GitHub
parent df0435c933
commit bbfb751d69
13 changed files with 34 additions and 28 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
#include <cassert>
#include <sys/resource.h>
#include "common/utilpp.h"
#include "common/visionbuf.h"
#include "common/visionipc.h"
#include "common/swaglog.h"
@@ -42,7 +43,7 @@ int main(int argc, char **argv) {
err = visionstream_init(&stream, VISION_STREAM_YUV_FRONT, true, &buf_info);
if (err) {
printf("visionstream connect fail\n");
usleep(100000);
util::sleep_for(100);
continue;
}
LOGW("connected with buffer size: %d", buf_info.buf_len);
+2 -1
View File
@@ -8,6 +8,7 @@
#include "common/visionipc.h"
#include "common/swaglog.h"
#include "common/clutil.h"
#include "common/utilpp.h"
#include "models/driving.h"
#include "messaging.hpp"
@@ -132,7 +133,7 @@ int main(int argc, char **argv) {
err = visionstream_init(&stream, VISION_STREAM_YUV, true, &buf_info);
if (err) {
LOGW("visionstream connect failed");
usleep(100000);
util::sleep_for(100);
continue;
}
LOGW("connected with buffer size: %d", buf_info.buf_len);