diff options
author | Elliott Hughes <enh@google.com> | 2016-11-15 18:09:46 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-11-15 18:09:46 +0000 |
commit | 3ee9807554c85c1faa7ec70bf46f9e7f84b8c3b6 (patch) | |
tree | 87775fd0d66866735b3d38a855964101be616111 /init/builtins.cpp | |
parent | 4286801ccb6a4adb61e6cfc11273f36c1c26eeea (diff) | |
parent | f3e731b3c5711f3d0de7d2c4a6fecace72fec25a (diff) |
Merge "Switch fastboot/init/libprocessgroup to std::this_thread::sleep_for."
am: f3e731b3c5
Change-Id: I2028bb8835c5e55e1bf8c88c3395253ded9d66d3
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 852423464..de75438ff 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 @@ static void unmount_and_fsck(const struct mntent *entry) { 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. */ @@ -754,7 +753,7 @@ static int do_powerctl(const std::vector<std::string>& args) { } // 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"; } |