diff options
author | Yabin Cui <yabinc@google.com> | 2016-07-13 15:53:25 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-07-14 18:33:23 -0700 |
commit | a36b574011244d0d3be9eb5bcf1062a3e365299f (patch) | |
tree | f54b823ab791153bd05e4c9831addf3db026101c | |
parent | 8fce5a6558249cd85451dee2540aaf766eb2bef9 (diff) | |
download | bionic-a36b574011244d0d3be9eb5bcf1062a3e365299f.tar.gz |
Force pthread_cond_timedwait_relative_np using CLOCK_MONOTONIC.
Previous patch changed pthread_cond_timedwait_relative_np to use
CLOCK_REALTIME, which causes app compatibility problem. So change
it back to CLOCK_MONOTONIC.
Bug: 30106240
Change-Id: I8e04058e92ede098f4f9f8d133f094001921441e
(cherry picked from commit fe4a4d8f67cf84b0b10d6c689f356229e057603b)
-rw-r--r-- | libc/bionic/pthread_cond.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/bionic/pthread_cond.cpp b/libc/bionic/pthread_cond.cpp index d36426c16..c35d9f159 100644 --- a/libc/bionic/pthread_cond.cpp +++ b/libc/bionic/pthread_cond.cpp @@ -224,16 +224,18 @@ extern "C" int pthread_cond_timedwait_monotonic_np(pthread_cond_t* cond_interfac return pthread_cond_timedwait_monotonic(cond_interface, mutex, abs_timeout); } +// Force this function using CLOCK_MONOTONIC because it was always using +// CLOCK_MONOTONIC in history. extern "C" int pthread_cond_timedwait_relative_np(pthread_cond_t* cond_interface, pthread_mutex_t* mutex, const timespec* rel_timeout) { timespec ts; timespec* abs_timeout = nullptr; if (rel_timeout != nullptr) { - absolute_timespec_from_timespec(ts, *rel_timeout, CLOCK_REALTIME); + absolute_timespec_from_timespec(ts, *rel_timeout, CLOCK_MONOTONIC); abs_timeout = &ts; } - return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, true, abs_timeout); + return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, false, abs_timeout); } extern "C" int pthread_cond_timeout_np(pthread_cond_t* cond_interface, |