| Index: runtime/bin/utils_linux.cc
|
| diff --git a/runtime/bin/utils_linux.cc b/runtime/bin/utils_linux.cc
|
| index 66e6929371936be9c7595e94f094a8fab0acdc06..4506f6f2b27aab964ba1d62a685c8b25850dbb6f 100644
|
| --- a/runtime/bin/utils_linux.cc
|
| +++ b/runtime/bin/utils_linux.cc
|
| @@ -96,7 +96,17 @@ int64_t TimerUtils::GetCurrentTimeMicros() {
|
| }
|
|
|
| void TimerUtils::Sleep(int64_t millis) {
|
| - usleep(millis * 1000);
|
| + // We must loop here because SIGPROF will interrupt usleep.
|
| + int64_t micros = millis * 1000;
|
| + int64_t start = GetCurrentTimeMicros();
|
| + while (micros > 0) {
|
| + usleep(micros);
|
| + int64_t now = GetCurrentTimeMicros();
|
| + int64_t delta = now - start;
|
| + ASSERT(delta >= 0);
|
| + start = now;
|
| + micros -= delta;
|
| + }
|
| }
|
|
|
| } // namespace bin
|
|
|