Merge "pthread barrier and spinlock types should only appear at API level 24."

This commit is contained in:
Elliott Hughes 2017-03-21 19:14:05 +00:00 committed by Gerrit Code Review
commit 72b6f4fae2
2 changed files with 14 additions and 0 deletions

View file

@ -44,6 +44,7 @@ typedef struct {
#endif
} pthread_attr_t;
#if __ANDROID_API__ >= __ANDROID_API_N__
typedef struct {
#if defined(__LP64__)
int64_t __private[4];
@ -51,8 +52,11 @@ typedef struct {
int32_t __private[8];
#endif
} pthread_barrier_t;
#endif
#if __ANDROID_API__ >= __ANDROID_API_N__
typedef int pthread_barrierattr_t;
#endif
typedef struct {
#if defined(__LP64__)
@ -88,6 +92,7 @@ typedef struct {
typedef long pthread_rwlockattr_t;
#if __ANDROID_API__ >= __ANDROID_API_N__
typedef struct {
#if defined(__LP64__)
int64_t __private;
@ -95,6 +100,7 @@ typedef struct {
int32_t __private[2];
#endif
} pthread_spinlock_t;
#endif
typedef long pthread_t;

View file

@ -69,7 +69,9 @@ enum {
#define PTHREAD_ONCE_INIT 0
#if __ANDROID_API__ >= __ANDROID_API_N__
#define PTHREAD_BARRIER_SERIAL_THREAD -1
#endif
#if defined(__LP64__)
#define PTHREAD_STACK_MIN (4 * PAGE_SIZE)
@ -178,23 +180,29 @@ int pthread_rwlock_trywrlock(pthread_rwlock_t* _Nonnull);
int pthread_rwlock_unlock(pthread_rwlock_t* _Nonnull);
int pthread_rwlock_wrlock(pthread_rwlock_t* _Nonnull);
#if __ANDROID_API__ >= __ANDROID_API_N__
int pthread_barrierattr_init(pthread_barrierattr_t* _Nonnull attr) __INTRODUCED_IN(24);
int pthread_barrierattr_destroy(pthread_barrierattr_t* _Nonnull attr) __INTRODUCED_IN(24);
int pthread_barrierattr_getpshared(const pthread_barrierattr_t* _Nonnull attr,
int* _Nonnull pshared) __INTRODUCED_IN(24);
int pthread_barrierattr_setpshared(pthread_barrierattr_t* _Nonnull attr, int pshared)
__INTRODUCED_IN(24);
#endif
#if __ANDROID_API__ >= __ANDROID_API_N__
int pthread_barrier_init(pthread_barrier_t* _Nonnull, const pthread_barrierattr_t*, unsigned)
__INTRODUCED_IN(24);
int pthread_barrier_destroy(pthread_barrier_t* _Nonnull) __INTRODUCED_IN(24);
int pthread_barrier_wait(pthread_barrier_t* _Nonnull) __INTRODUCED_IN(24);
#endif
#if __ANDROID_API__ >= __ANDROID_API_N__
int pthread_spin_destroy(pthread_spinlock_t* _Nonnull) __INTRODUCED_IN(24);
int pthread_spin_init(pthread_spinlock_t* _Nonnull, int) __INTRODUCED_IN(24);
int pthread_spin_lock(pthread_spinlock_t* _Nonnull) __INTRODUCED_IN(24);
int pthread_spin_trylock(pthread_spinlock_t* _Nonnull) __INTRODUCED_IN(24);
int pthread_spin_unlock(pthread_spinlock_t* _Nonnull) __INTRODUCED_IN(24);
#endif
pthread_t pthread_self(void) __attribute_const__;