Feature test macros overhaul: Cygwin pthread.h

As a Cygwin-specific header, there is no need to guard functions based on
capability macros.  Instead, guard several blocks based on additions or
removals in later versions of POSIX.1, along with a few which are only
XSI or GNU extensions.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
Yaakov Selkowitz 2016-04-01 17:30:41 -05:00
parent 9e277154ab
commit b3acb347c4
1 changed files with 21 additions and 8 deletions

View File

@ -75,9 +75,6 @@ int pthread_attr_getinheritsched (const pthread_attr_t *, int *);
int pthread_attr_getschedparam (const pthread_attr_t *, struct sched_param *); int pthread_attr_getschedparam (const pthread_attr_t *, struct sched_param *);
int pthread_attr_getschedpolicy (const pthread_attr_t *, int *); int pthread_attr_getschedpolicy (const pthread_attr_t *, int *);
int pthread_attr_getscope (const pthread_attr_t *, int *); int pthread_attr_getscope (const pthread_attr_t *, int *);
int pthread_attr_getstack (const pthread_attr_t *, void **, size_t *);
int pthread_attr_getstackaddr (const pthread_attr_t *, void **)
__attribute__ ((__deprecated__));
int pthread_attr_init (pthread_attr_t *); int pthread_attr_init (pthread_attr_t *);
int pthread_attr_setdetachstate (pthread_attr_t *, int); int pthread_attr_setdetachstate (pthread_attr_t *, int);
int pthread_attr_setguardsize (pthread_attr_t *, size_t); int pthread_attr_setguardsize (pthread_attr_t *, size_t);
@ -86,16 +83,18 @@ int pthread_attr_setschedparam (pthread_attr_t *, const struct sched_param *);
int pthread_attr_setschedpolicy (pthread_attr_t *, int); int pthread_attr_setschedpolicy (pthread_attr_t *, int);
int pthread_attr_setscope (pthread_attr_t *, int); int pthread_attr_setscope (pthread_attr_t *, int);
#ifdef _POSIX_THREAD_ATTR_STACKADDR #if __POSIX_VISIBLE >= 200112
int pthread_attr_getstack (const pthread_attr_t *, void **, size_t *);
int pthread_attr_setstack (pthread_attr_t *, void *, size_t); int pthread_attr_setstack (pthread_attr_t *, void *, size_t);
#endif
#if __POSIX_VISIBLE < 200809
int pthread_attr_getstackaddr (const pthread_attr_t *, void **)
__attribute__ ((__deprecated__));
int pthread_attr_setstackaddr (pthread_attr_t *, void *) int pthread_attr_setstackaddr (pthread_attr_t *, void *)
__attribute__ ((__deprecated__)); __attribute__ ((__deprecated__));
#endif #endif
#ifdef _POSIX_THREAD_ATTR_STACKSIZE
int pthread_attr_getstacksize (const pthread_attr_t *, size_t *); int pthread_attr_getstacksize (const pthread_attr_t *, size_t *);
int pthread_attr_setstacksize (pthread_attr_t *, size_t); int pthread_attr_setstacksize (pthread_attr_t *, size_t);
#endif
int pthread_cancel (pthread_t); int pthread_cancel (pthread_t);
/* Macros for cleanup_push and pop; /* Macros for cleanup_push and pop;
@ -135,6 +134,7 @@ int pthread_condattr_setclock (pthread_condattr_t *, clockid_t);
int pthread_condattr_setpshared (pthread_condattr_t *, int); int pthread_condattr_setpshared (pthread_condattr_t *, int);
/* Barriers */ /* Barriers */
#if __POSIX_VISIBLE >= 200112
int pthread_barrierattr_init (pthread_barrierattr_t *); int pthread_barrierattr_init (pthread_barrierattr_t *);
int pthread_barrierattr_setpshared (pthread_barrierattr_t *, int); int pthread_barrierattr_setpshared (pthread_barrierattr_t *, int);
int pthread_barrierattr_getpshared (const pthread_barrierattr_t *, int *); int pthread_barrierattr_getpshared (const pthread_barrierattr_t *, int *);
@ -143,6 +143,7 @@ int pthread_barrier_init (pthread_barrier_t *,
const pthread_barrierattr_t *, unsigned); const pthread_barrierattr_t *, unsigned);
int pthread_barrier_destroy (pthread_barrier_t *); int pthread_barrier_destroy (pthread_barrier_t *);
int pthread_barrier_wait (pthread_barrier_t *); int pthread_barrier_wait (pthread_barrier_t *);
#endif
/* Threads */ /* Threads */
int pthread_create (pthread_t *, const pthread_attr_t *, int pthread_create (pthread_t *, const pthread_attr_t *,
@ -150,7 +151,9 @@ int pthread_create (pthread_t *, const pthread_attr_t *,
int pthread_detach (pthread_t); int pthread_detach (pthread_t);
int pthread_equal (pthread_t, pthread_t); int pthread_equal (pthread_t, pthread_t);
void pthread_exit (void *) __attribute__ ((__noreturn__)); void pthread_exit (void *) __attribute__ ((__noreturn__));
#if __POSIX_VISIBLE >= 200112
int pthread_getcpuclockid (pthread_t, clockid_t *); int pthread_getcpuclockid (pthread_t, clockid_t *);
#endif
int pthread_getschedparam (pthread_t, int *, struct sched_param *); int pthread_getschedparam (pthread_t, int *, struct sched_param *);
void *pthread_getspecific (pthread_key_t); void *pthread_getspecific (pthread_key_t);
int pthread_join (pthread_t, void **); int pthread_join (pthread_t, void **);
@ -177,13 +180,16 @@ int pthread_mutexattr_setpshared (pthread_mutexattr_t *, int);
int pthread_mutexattr_settype (pthread_mutexattr_t *, int); int pthread_mutexattr_settype (pthread_mutexattr_t *, int);
/* Spinlocks */ /* Spinlocks */
#if __POSIX_VISIBLE >= 200112
int pthread_spin_destroy (pthread_spinlock_t *); int pthread_spin_destroy (pthread_spinlock_t *);
int pthread_spin_init (pthread_spinlock_t *, int); int pthread_spin_init (pthread_spinlock_t *, int);
int pthread_spin_lock (pthread_spinlock_t *); int pthread_spin_lock (pthread_spinlock_t *);
int pthread_spin_trylock (pthread_spinlock_t *); int pthread_spin_trylock (pthread_spinlock_t *);
int pthread_spin_unlock (pthread_spinlock_t *); int pthread_spin_unlock (pthread_spinlock_t *);
#endif
/* RW Locks */ /* RW Locks */
#if __XSI_VISIBLE >= 500 || __POSIX_VISIBLE >= 200112
int pthread_rwlock_destroy (pthread_rwlock_t *rwlock); int pthread_rwlock_destroy (pthread_rwlock_t *rwlock);
int pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr); int pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr);
int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock); int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock);
@ -196,12 +202,15 @@ int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *attr,
int *pshared); int *pshared);
int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared); int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared);
int pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr); int pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr);
#endif
int pthread_once (pthread_once_t *, void (*)(void)); int pthread_once (pthread_once_t *, void (*)(void));
#if __XSI_VISIBLE >= 500
/* Concurrency levels - X/Open interface */ /* Concurrency levels - X/Open interface */
int pthread_getconcurrency (void); int pthread_getconcurrency (void);
int pthread_setconcurrency (int); int pthread_setconcurrency (int);
#endif
pthread_t pthread_self (void); pthread_t pthread_self (void);
@ -214,11 +223,15 @@ void pthread_testcancel (void);
/* Non posix calls */ /* Non posix calls */
#if __GNU_VISIBLE
int pthread_getattr_np (pthread_t, pthread_attr_t *); int pthread_getattr_np (pthread_t, pthread_attr_t *);
int pthread_sigqueue (pthread_t *, int, const union sigval); int pthread_sigqueue (pthread_t *, int, const union sigval);
int pthread_yield (void);
#endif
#if __MISC_VISIBLE /* HP-UX, others? */
int pthread_suspend (pthread_t); int pthread_suspend (pthread_t);
int pthread_continue (pthread_t); int pthread_continue (pthread_t);
int pthread_yield (void); #endif
#ifdef __cplusplus #ifdef __cplusplus
} }