Expose pthread_mutex_lock_timeout_np to the NDK.

The proper API for this isn't available until L, so expose this for
API levels earlier than that.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/420
Change-Id: I382b8f557be9530f3e13aaae353b4a6e7f9301ab
This commit is contained in:
Dan Albert 2017-06-12 14:17:49 -07:00
parent 4f61181428
commit 8c67f1e617

View file

@ -160,6 +160,18 @@ int pthread_mutex_timedlock(pthread_mutex_t* _Nonnull, const struct timespec* _N
int pthread_mutex_trylock(pthread_mutex_t* _Nonnull);
int pthread_mutex_unlock(pthread_mutex_t* _Nonnull);
#if defined(__LP32__) && __ANDROID_API__ < 21
/*
* Cruft for supporting old API levels. Pre-L we didn't have
* pthread_mutex_timedlock, instead we had pthread_mutex_lock_timeout_np. NDK
* users targeting pre-L still need this, but anyone targeting L or newer (or
* LP64 code) should just use pthread_mutex_timedlock.
*
* https://github.com/android-ndk/ndk/issues/420
*/
int pthread_mutex_lock_timeout_np(pthread_mutex_t* mutex, unsigned msecs);
#endif
int pthread_once(pthread_once_t* _Nonnull, void (* _Nonnull init_routine)(void));
int pthread_rwlockattr_init(pthread_rwlockattr_t* _Nonnull);