Merge "Expose pthread_mutex_lock_timeout_np to the NDK."
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index c34d1a3..20b6c5b 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -160,6 +160,18 @@
 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);