diff options
author | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 21:11:57 +0000 |
---|---|---|
committer | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 21:11:57 +0000 |
commit | d0d7292e427b7ec13c40556bba4bb14d1384515b (patch) | |
tree | 466edef1d84b81ef051abc63c6945de296c95fbe /base/synchronization | |
parent | ce8efce0aebe5198fc53c3ec8760fb84d1b54dd3 (diff) | |
download | chromium_src-d0d7292e427b7ec13c40556bba4bb14d1384515b.zip chromium_src-d0d7292e427b7ec13c40556bba4bb14d1384515b.tar.gz chromium_src-d0d7292e427b7ec13c40556bba4bb14d1384515b.tar.bz2 |
The Android team is deprecating pthread_cond_timedwait_monotonic in favor of the more standard pthread_condattr_getclock.
Update usage in Chromium such that it will use the standards based code path when it's present.
Bug:349865
Review URL: https://codereview.chromium.org/183763031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/synchronization')
-rw-r--r-- | base/synchronization/condition_variable_posix.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/base/synchronization/condition_variable_posix.cc b/base/synchronization/condition_variable_posix.cc index e70a301..8492a01 100644 --- a/base/synchronization/condition_variable_posix.cc +++ b/base/synchronization/condition_variable_posix.cc @@ -23,10 +23,12 @@ ConditionVariable::ConditionVariable(Lock* user_lock) int rv = 0; // http://crbug.com/293736 // NaCl doesn't support monotonic clock based absolute deadlines. - // Android supports it through the non-standard - // pthread_cond_timedwait_monotonic_np. + // On older Android platform versions, it's supported through the + // non-standard pthread_cond_timedwait_monotonic_np. Newer platform + // versions have pthread_condattr_setclock. // Mac can use relative time deadlines. -#if !defined(OS_MACOSX) && !defined(OS_NACL) && !defined(OS_ANDROID) +#if !defined(OS_MACOSX) && !defined(OS_NACL) && \ + !(defined(OS_ANDROID) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)) pthread_condattr_t attrs; rv = pthread_condattr_init(&attrs); DCHECK_EQ(0, rv); @@ -93,12 +95,12 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) { absolute_time.tv_nsec %= Time::kNanosecondsPerSecond; DCHECK_GE(absolute_time.tv_sec, now.tv_sec); // Overflow paranoia -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC) int rv = pthread_cond_timedwait_monotonic_np( &condition_, user_mutex_, &absolute_time); #else int rv = pthread_cond_timedwait(&condition_, user_mutex_, &absolute_time); -#endif // OS_ANDROID +#endif // OS_ANDROID && HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC #endif // OS_MACOSX DCHECK(rv == 0 || rv == ETIMEDOUT); |