diff options
author | Narayan Kamath <narayan@google.com> | 2014-03-04 12:10:03 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-03-04 12:54:03 +0000 |
commit | 7040982073ad0042f9108de8e23b2e5660fc7dbf (patch) | |
tree | 6f9dba655b527e2b77b3e962e646a667a533c596 /vm/Sync.cpp | |
parent | 415add46dbc6d1957d405d7dc7ace8a1fd91f339 (diff) | |
download | android_dalvik-7040982073ad0042f9108de8e23b2e5660fc7dbf.tar.gz android_dalvik-7040982073ad0042f9108de8e23b2e5660fc7dbf.tar.bz2 android_dalvik-7040982073ad0042f9108de8e23b2e5660fc7dbf.zip |
Remove usage of pthread_cond_timedwait_monotonic_np.
Replaced with the posix compliant pthread_condattr_setclock.
Unfortunately, mac OS doesn't support CLOCK_MONOTONIC
or (pthread_condattr_setclock) so we fall back to using
the "default" pthread_condattr_t value like we did earlier.
Change-Id: I23475ef0d4e392d9e14402c6b5f8f658c5ed4063
Diffstat (limited to 'vm/Sync.cpp')
-rw-r--r-- | vm/Sync.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/vm/Sync.cpp b/vm/Sync.cpp index f42004cd1..d2ef49fb5 100644 --- a/vm/Sync.cpp +++ b/vm/Sync.cpp @@ -550,7 +550,7 @@ static void absoluteTime(s8 msec, s4 nsec, struct timespec *ts) { s8 endSec; -#ifdef HAVE_TIMEDWAIT_MONOTONIC +#ifdef HAVE_POSIX_CLOCKS clock_gettime(CLOCK_MONOTONIC, ts); #else { @@ -578,14 +578,9 @@ static void absoluteTime(s8 msec, s4 nsec, struct timespec *ts) int dvmRelativeCondWait(pthread_cond_t* cond, pthread_mutex_t* mutex, s8 msec, s4 nsec) { - int ret; struct timespec ts; absoluteTime(msec, nsec, &ts); -#if defined(HAVE_TIMEDWAIT_MONOTONIC) - ret = pthread_cond_timedwait_monotonic(cond, mutex, &ts); -#else - ret = pthread_cond_timedwait(cond, mutex, &ts); -#endif + int ret = pthread_cond_timedwait(cond, mutex, &ts); assert(ret == 0 || ret == ETIMEDOUT); return ret; } @@ -710,11 +705,7 @@ static void waitMonitor(Thread* self, Monitor* mon, s8 msec, s4 nsec, ret = pthread_cond_wait(&self->waitCond, &self->waitMutex); assert(ret == 0); } else { -#ifdef HAVE_TIMEDWAIT_MONOTONIC - ret = pthread_cond_timedwait_monotonic(&self->waitCond, &self->waitMutex, &ts); -#else ret = pthread_cond_timedwait(&self->waitCond, &self->waitMutex, &ts); -#endif assert(ret == 0 || ret == ETIMEDOUT); } if (self->interrupted) { |