Switch fastboot/init/libprocessgroup to std::this_thread::sleep_for.
Bug: http://b/32878766
Test: boots
Change-Id: Ie0ddfb7e60f2da5f6eefbb10c83a92e88c137ae3
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 94dc832..ebdc8c9 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -38,6 +38,8 @@
#include <linux/loop.h>
#include <linux/module.h>
+#include <thread>
+
#include <selinux/selinux.h>
#include <selinux/label.h>
@@ -65,7 +67,6 @@
#include "util.h"
#define chmod DO_NOT_USE_CHMOD_USE_FCHMODAT_SYMLINK_NOFOLLOW
-#define UNMOUNT_CHECK_MS 5000
#define UNMOUNT_CHECK_TIMES 10
static constexpr std::chrono::nanoseconds kCommandRetryTimeout = 5s;
@@ -192,11 +193,9 @@
close(fd);
break;
} else if (errno == EBUSY) {
- /* Some processes using |entry->mnt_dir| are still alive. Wait for a
- * while then retry.
- */
- TEMP_FAILURE_RETRY(
- usleep(UNMOUNT_CHECK_MS * 1000 / UNMOUNT_CHECK_TIMES));
+ // Some processes using |entry->mnt_dir| are still alive. Wait for a
+ // while then retry.
+ std::this_thread::sleep_for(5000ms / UNMOUNT_CHECK_TIMES);
continue;
} else {
/* Cannot open the device. Give up. */
@@ -749,7 +748,7 @@
}
// Wait a bit before recounting the number or running services.
- usleep(50000 /*us*/);
+ std::this_thread::sleep_for(50ms);
}
LOG(VERBOSE) << "Terminating running services took " << t.duration() << " seconds";
}