pthreadtypes.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /* Machine-specific pthread type layouts. Alpha version.
  2. Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _BITS_PTHREADTYPES_H
  16. #define _BITS_PTHREADTYPES_H 1
  17. #define __SIZEOF_PTHREAD_ATTR_T 56
  18. #define __SIZEOF_PTHREAD_MUTEX_T 40
  19. #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
  20. #define __SIZEOF_PTHREAD_COND_T 48
  21. #define __SIZEOF_PTHREAD_CONDATTR_T 4
  22. #define __SIZEOF_PTHREAD_RWLOCK_T 56
  23. #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
  24. #define __SIZEOF_PTHREAD_BARRIER_T 32
  25. #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
  26. /* Thread identifiers. The structure of the attribute type is
  27. deliberately not exposed. */
  28. typedef unsigned long int pthread_t;
  29. typedef union
  30. {
  31. char __size[__SIZEOF_PTHREAD_ATTR_T];
  32. long int __align;
  33. } pthread_attr_t;
  34. typedef struct __pthread_internal_list
  35. {
  36. struct __pthread_internal_list *__prev;
  37. struct __pthread_internal_list *__next;
  38. } __pthread_list_t;
  39. /* Data structures for mutex handling. The structure of the attribute
  40. type is deliberately not exposed. */
  41. typedef union
  42. {
  43. struct __pthread_mutex_s
  44. {
  45. int __lock;
  46. unsigned int __count;
  47. int __owner;
  48. unsigned int __nusers;
  49. /* KIND must stay at this position in the structure to maintain
  50. binary compatibility. */
  51. int __kind;
  52. int __spins;
  53. __pthread_list_t __list;
  54. #define __PTHREAD_MUTEX_HAVE_PREV 1
  55. } __data;
  56. char __size[__SIZEOF_PTHREAD_MUTEX_T];
  57. long int __align;
  58. } pthread_mutex_t;
  59. typedef union
  60. {
  61. char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
  62. int __align;
  63. } pthread_mutexattr_t;
  64. /* Data structure for conditional variable handling. The structure of
  65. the attribute type is deliberately not exposed. */
  66. typedef union
  67. {
  68. struct
  69. {
  70. int __lock;
  71. unsigned int __futex;
  72. __extension__ unsigned long long int __total_seq;
  73. __extension__ unsigned long long int __wakeup_seq;
  74. __extension__ unsigned long long int __woken_seq;
  75. void *__mutex;
  76. unsigned int __nwaiters;
  77. unsigned int __broadcast_seq;
  78. } __data;
  79. char __size[__SIZEOF_PTHREAD_COND_T];
  80. __extension__ long long int __align;
  81. } pthread_cond_t;
  82. typedef union
  83. {
  84. char __size[__SIZEOF_PTHREAD_CONDATTR_T];
  85. int __align;
  86. } pthread_condattr_t;
  87. /* Keys for thread-specific data */
  88. typedef unsigned int pthread_key_t;
  89. /* Once-only execution */
  90. typedef int pthread_once_t;
  91. #if defined __USE_UNIX98 || defined __USE_XOPEN2K
  92. /* Data structure for read-write lock variable handling. The
  93. structure of the attribute type is deliberately not exposed. */
  94. typedef union
  95. {
  96. struct
  97. {
  98. int __lock;
  99. unsigned int __nr_readers;
  100. unsigned int __readers_wakeup;
  101. unsigned int __writer_wakeup;
  102. unsigned int __nr_readers_queued;
  103. unsigned int __nr_writers_queued;
  104. int __writer;
  105. int __shared;
  106. unsigned long int __pad1;
  107. unsigned long int __pad2;
  108. /* FLAGS must stay at this position in the structure to maintain
  109. binary compatibility. */
  110. unsigned int __flags;
  111. } __data;
  112. char __size[__SIZEOF_PTHREAD_RWLOCK_T];
  113. long int __align;
  114. } pthread_rwlock_t;
  115. typedef union
  116. {
  117. char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
  118. long int __align;
  119. } pthread_rwlockattr_t;
  120. #endif
  121. #ifdef __USE_XOPEN2K
  122. /* POSIX spinlock data type. */
  123. typedef volatile int pthread_spinlock_t;
  124. /* POSIX barriers data type. The structure of the type is
  125. deliberately not exposed. */
  126. typedef union
  127. {
  128. char __size[__SIZEOF_PTHREAD_BARRIER_T];
  129. long int __align;
  130. } pthread_barrier_t;
  131. typedef union
  132. {
  133. char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
  134. int __align;
  135. } pthread_barrierattr_t;
  136. #endif
  137. #endif /* bits/pthreadtypes.h */