From: Mathieu Chartier Date: Thu, 23 Feb 2017 00:07:23 +0000 (-0800) Subject: Fix mac build X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dbf4440c37e11755c9c2ef15390df541992da54c;p=android-x86%2Fart.git Fix mac build Add some #if to accomplish this. Test: mm Change-Id: I934e805a0b41e172cb419a3648935c6db789ad57 --- diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index ca0c3e3d1..be756286f 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -423,12 +423,14 @@ 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); +#ifndef __APPLE__ + pthread_condattr_t condattr; 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); +#endif 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); @@ -486,7 +488,11 @@ class WatchDog { void Wait() { timespec timeout_ts; +#if defined(__APPLE__) + InitTimeSpec(true, CLOCK_REALTIME, timeout_in_milliseconds_, 0, &timeout_ts); +#else InitTimeSpec(true, CLOCK_MONOTONIC, timeout_in_milliseconds_, 0, &timeout_ts); +#endif const char* reason = "dex2oat watch dog thread waiting"; CHECK_WATCH_DOG_PTHREAD_CALL(pthread_mutex_lock, (&mutex_), reason); while (!shutting_down_) {