History log of /bionic/libc/bionic/bionic_time_conversions.cpp
Revision Date Author Comments
ac49cedc7e2bab2073a0895ef01e31dac84f590b 17-Aug-2017 Tom Cherry <tomcherry@google.com> Always use CLOCK_MONOTONIC for pthreads and semaphores

pthread's and semaphore's default behavior is to use CLOCK_REALTIME,
however this behavior is essentially never intended, as that clock is
prone to change discontinuously.

What users really intend is to use CLOCK_MONOTONIC, however only
pthread_cond_timedwait() provides this as an option and even there, a
large amount of existing code does not opt into CLOCK_MONOTONIC.

We have seen numerous bugs directly attributable to this difference.
Therefore, we provide this general workaround to always use
CLOCK_MONOTONIC for waiting, regardless of what the input timespec
is.

Specifically this impacts the below APIs:
pthread_mutex_timedlock()
pthread_cond_timedwait()
pthread_rwlock_timedrdlock()
pthread_rwlock_timedwrlock()
sem_timedwait()

Test: boot bullhead, boot sailfish
Test: bionic pthread/semaphore unit tests
Test: check that pthread_cond_timedwait() timeouts are uneffected by
CLOCK_REALTIME time changes

Bug: 64694413
Bug: 64623895
Bug: 35756266
Bug: 35678943
Change-Id: Ibba98f5d88be1c306d14e9b9366302ecbef6d534
5db4b6e5de626eb473e3d9c70eba99749eee20cf 05-Apr-2016 Elliott Hughes <enh@google.com> Make it harder to use a broken legacy function by accident.

This function only exists for backwards compatibility, so leave it as it was.

Bug: http://b/26944282
Change-Id: I31973d1402660933103ee2d815649ab9569e4dfc
c9a659c57b256001fd63f9825bde69e660c2655b 06-Nov-2015 Yabin Cui <yabinc@google.com> Use FUTEX_WAIT_BITSET to avoid converting timeouts.

Add unittests for pthread APIs with timeout parameter.

Bug: 17569991

Change-Id: I6b3b9b2feae03680654cd64c3112ce7644632c87
04303f5a8ab9a992f3671d46b6ee2171582cbd61 19-Sep-2014 Elliott Hughes <enh@google.com> Add semaphore tests, fix sem_destroy.

Bug: https://code.google.com/p/android/issues/detail?id=76088
Change-Id: I4a0561b23e90312384d40a1c804ca64ee98f4066
11952073af22568bba0b661f7a9d4402c443a888 25-Oct-2013 Elliott Hughes <enh@google.com> Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls.

(aarch64 kernels don't have these system calls.)

Change-Id: I6f64075aa412f71520f2df71c3d69b647f91c1ca