Back to index

glibc  2.9
pthreadtypes.h
Go to the documentation of this file.
00001 /* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _BITS_PTHREADTYPES_H
00021 #define _BITS_PTHREADTYPES_H       1
00022 
00023 #define __SIZEOF_PTHREAD_ATTR_T 56
00024 #define __SIZEOF_PTHREAD_MUTEX_T 40
00025 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
00026 #define __SIZEOF_PTHREAD_COND_T 48
00027 #define __SIZEOF_PTHREAD_CONDATTR_T 4
00028 #define __SIZEOF_PTHREAD_RWLOCK_T 56
00029 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
00030 #define __SIZEOF_PTHREAD_BARRIER_T 32
00031 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
00032 
00033 
00034 /* Thread identifiers.  The structure of the attribute type is not
00035    exposed on purpose.  */
00036 typedef unsigned long int pthread_t;
00037 
00038 
00039 typedef union
00040 {
00041   char __size[__SIZEOF_PTHREAD_ATTR_T];
00042   long int __align;
00043 } pthread_attr_t;
00044 
00045 
00046 typedef struct __pthread_internal_list
00047 {
00048   struct __pthread_internal_list *__prev;
00049   struct __pthread_internal_list *__next;
00050 } __pthread_list_t;
00051 
00052 
00053 /* Data structures for mutex handling.  The structure of the attribute
00054    type is not exposed on purpose.  */
00055 typedef union
00056 {
00057   struct __pthread_mutex_s
00058   {
00059     int __lock;
00060     unsigned int __count;
00061     int __owner;
00062     unsigned int __nusers;
00063     /* KIND must stay at this position in the structure to maintain
00064        binary compatibility.  */
00065     int __kind;
00066     int __spins;
00067     __pthread_list_t __list;
00068 #define __PTHREAD_MUTEX_HAVE_PREV  1
00069   } __data;
00070   char __size[__SIZEOF_PTHREAD_MUTEX_T];
00071   long int __align;
00072 } pthread_mutex_t;
00073 
00074 typedef union
00075 {
00076   char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
00077   int __align;
00078 } pthread_mutexattr_t;
00079 
00080 
00081 /* Data structure for conditional variable handling.  The structure of
00082    the attribute type is not exposed on purpose.  */
00083 typedef union
00084 {
00085   struct
00086   {
00087     int __lock;
00088     unsigned int __futex;
00089     __extension__ unsigned long long int __total_seq;
00090     __extension__ unsigned long long int __wakeup_seq;
00091     __extension__ unsigned long long int __woken_seq;
00092     void *__mutex;
00093     unsigned int __nwaiters;
00094     unsigned int __broadcast_seq;
00095   } __data;
00096   char __size[__SIZEOF_PTHREAD_COND_T];
00097   long int __align;
00098 } pthread_cond_t;
00099 
00100 typedef union
00101 {
00102   char __size[__SIZEOF_PTHREAD_CONDATTR_T];
00103   int __align;
00104 } pthread_condattr_t;
00105 
00106 
00107 /* Keys for thread-specific data */
00108 typedef unsigned int pthread_key_t;
00109 
00110 
00111 /* Once-only execution */
00112 typedef int pthread_once_t;
00113 
00114 
00115 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
00116 /* Data structure for read-write lock variable handling.  The
00117    structure of the attribute type is not exposed on purpose.  */
00118 typedef union
00119 {
00120   struct
00121   {
00122     int __lock;
00123     unsigned int __nr_readers;
00124     unsigned int __readers_wakeup;
00125     unsigned int __writer_wakeup;
00126     unsigned int __nr_readers_queued;
00127     unsigned int __nr_writers_queued;
00128     int __writer;
00129     int __shared;
00130     unsigned long int __pad1;
00131     unsigned long int __pad2;
00132     /* FLAGS must stay at this position in the structure to maintain
00133        binary compatibility.  */
00134     unsigned int __flags;
00135   } __data;
00136   char __size[__SIZEOF_PTHREAD_RWLOCK_T];
00137   long int __align;
00138 } pthread_rwlock_t;
00139 
00140 typedef union
00141 {
00142   char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
00143   long int __align;
00144 } pthread_rwlockattr_t;
00145 #endif
00146 
00147 
00148 #ifdef __USE_XOPEN2K
00149 /* POSIX spinlock data type.  */
00150 typedef volatile int pthread_spinlock_t;
00151 
00152 
00153 /* POSIX barriers data type.  The structure of the type is
00154    deliberately not exposed.  */
00155 typedef union
00156 {
00157   char __size[__SIZEOF_PTHREAD_BARRIER_T];
00158   long int __align;
00159 } pthread_barrier_t;
00160 
00161 typedef union
00162 {
00163   char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
00164   int __align;
00165 } pthread_barrierattr_t;
00166 #endif
00167 
00168 
00169 #endif /* bits/pthreadtypes.h */