diff options
| -rw-r--r-- | dex2oat/dex2oat.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index dded966cb7..ca0c3e3d11 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -423,8 +423,12 @@ class WatchDog { : timeout_in_milliseconds_(timeout_in_milliseconds), shutting_down_(false) { const char* reason = "dex2oat watch dog thread startup"; + pthread_condattr_t condattr; CHECK_WATCH_DOG_PTHREAD_CALL(pthread_mutex_init, (&mutex_, nullptr), reason); - CHECK_WATCH_DOG_PTHREAD_CALL(pthread_cond_init, (&cond_, nullptr), reason); + CHECK_WATCH_DOG_PTHREAD_CALL(pthread_condattr_init, (&condattr), reason); + CHECK_WATCH_DOG_PTHREAD_CALL(pthread_condattr_setclock, (&condattr, CLOCK_MONOTONIC), reason); + CHECK_WATCH_DOG_PTHREAD_CALL(pthread_cond_init, (&cond_, &condattr), reason); + CHECK_WATCH_DOG_PTHREAD_CALL(pthread_condattr_destroy, (&condattr), reason); CHECK_WATCH_DOG_PTHREAD_CALL(pthread_attr_init, (&attr_), reason); CHECK_WATCH_DOG_PTHREAD_CALL(pthread_create, (&pthread_, &attr_, &CallBack, this), reason); CHECK_WATCH_DOG_PTHREAD_CALL(pthread_attr_destroy, (&attr_), reason); @@ -482,7 +486,7 @@ class WatchDog { void Wait() { timespec timeout_ts; - InitTimeSpec(true, CLOCK_REALTIME, timeout_in_milliseconds_, 0, &timeout_ts); + InitTimeSpec(true, CLOCK_MONOTONIC, timeout_in_milliseconds_, 0, &timeout_ts); const char* reason = "dex2oat watch dog thread waiting"; CHECK_WATCH_DOG_PTHREAD_CALL(pthread_mutex_lock, (&mutex_), reason); while (!shutting_down_) { |