From e882756311c7b06e59fcc8e582f03852b7dcfd30 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 17 Feb 2011 17:16:20 -0500 Subject: reorganize pthread data structures and move the definitions to alltypes.h this allows sys/types.h to provide the pthread types, as required by POSIX. this design also facilitates forcing ABI-compatible sizes in the arch-specific alltypes.h, while eliminating the need for developers changing the internals of the pthread types to poke around with arch-specific headers they may not be able to test. --- include/pthread.h | 57 ++++++++++++------------------------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) (limited to 'include/pthread.h') diff --git a/include/pthread.h b/include/pthread.h index e820ae55..749a0e8c 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -8,6 +8,18 @@ extern "C" { #define __NEED_struct_timespec #define __NEED_sigset_t #define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_pthread_mutexattr_t +#define __NEED_pthread_condattr_t +#define __NEED_pthread_rwlockattr_t +#define __NEED_pthread_barrierattr_t +#define __NEED_pthread_mutex_t +#define __NEED_pthread_cond_t +#define __NEED_pthread_rwlock_t +#define __NEED_pthread_barrier_t +#define __NEED_pthread_spinlock_t +#define __NEED_pthread_key_t +#define __NEED_pthread_once_t #define __NEED_size_t #include @@ -15,51 +27,6 @@ extern "C" { #include #include -typedef int pthread_once_t, pthread_key_t, pthread_spinlock_t; -typedef int pthread_mutexattr_t, pthread_condattr_t, pthread_barrierattr_t; - -typedef struct { - size_t __guardsize; - size_t __stacksize; - unsigned __detach : 1; - unsigned __pad : 31; - int __attr[6]; -} pthread_attr_t; - -typedef struct { - int __attr[2]; -} pthread_rwlockattr_t; - -typedef struct { - int __type; - int __lock; - pthread_t __owner; - int __pad2; - int __waiters; - int __pad; -} pthread_mutex_t; - -typedef struct { - int __block; - int __pad[11]; -} pthread_cond_t; - -typedef struct { - int __wrlock; - int __readers; - int __waiters; - int __owner; - int __pad[4]; -} pthread_rwlock_t; - -typedef struct { - int __count; - int __limit; - int __left; - int __waiters; - int __barrier[1]; -} pthread_barrier_t; - #define PTHREAD_CREATE_JOINABLE 0 #define PTHREAD_CREATE_DETACHED 1 -- cgit v1.2.1