summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-17 17:16:20 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-17 17:16:20 -0500
commite882756311c7b06e59fcc8e582f03852b7dcfd30 (patch)
treeaead1d2311ed1d3b68dd2b1f02ff6eed2c5ea2ea /include
parent4fd159568aa1852fbbe6c11d35ccecaec3715d7c (diff)
downloadmusl-e882756311c7b06e59fcc8e582f03852b7dcfd30.tar.gz
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.
Diffstat (limited to 'include')
-rw-r--r--include/pthread.h57
-rw-r--r--include/sys/types.h14
2 files changed, 26 insertions, 45 deletions
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 <bits/alltypes.h>
@@ -15,51 +27,6 @@ extern "C" {
#include <sched.h>
#include <time.h>
-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
diff --git a/include/sys/types.h b/include/sys/types.h
index 8be19e6b..7a126b07 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -42,6 +42,20 @@ extern "C" {
#define __NEED_suseconds_t
#define __NEED_blksize_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
+
#include <bits/alltypes.h>
#ifdef _GNU_SOURCE