pthreadtypes.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * This file is subject to the terms and conditions of the LGPL V2.1
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2019 Kalray Inc.
  7. */
  8. #ifndef _BITS_PTHREADTYPES_H
  9. #define _BITS_PTHREADTYPES_H 1
  10. #include <endian.h>
  11. #define __SIZEOF_PTHREAD_ATTR_T 64
  12. #define __SIZEOF_PTHREAD_MUTEX_T 48
  13. #define __SIZEOF_PTHREAD_MUTEXATTR_T 8
  14. #define __SIZEOF_PTHREAD_COND_T 72
  15. #define __SIZEOF_PTHREAD_COND_COMPAT_T 48
  16. #define __SIZEOF_PTHREAD_CONDATTR_T 8
  17. #define __SIZEOF_PTHREAD_RWLOCK_T 80
  18. #define __SIZEOF_PTHREAD_RWLOCKATTR_T 16
  19. #define __SIZEOF_PTHREAD_BARRIER_T 32
  20. #define __SIZEOF_PTHREAD_BARRIERATTR_T 16
  21. #define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
  22. /* Thread identifiers. The structure of the attribute type is not
  23. exposed on purpose. */
  24. typedef unsigned long int pthread_t;
  25. union pthread_attr_t
  26. {
  27. char __size[__SIZEOF_PTHREAD_ATTR_T];
  28. long int __align;
  29. };
  30. #ifndef __have_pthread_attr_t
  31. typedef union pthread_attr_t pthread_attr_t;
  32. # define __have_pthread_attr_t1
  33. #endif
  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 not exposed on purpose. */
  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 with static initializers. */
  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. /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
  60. #define __PTHREAD_SPINS 0
  61. typedef union
  62. {
  63. char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
  64. long int __align;
  65. } pthread_mutexattr_t;
  66. /* Data structure for conditional variable handling. The structure of
  67. the attribute type is not exposed on purpose. */
  68. typedef union
  69. {
  70. struct
  71. {
  72. int __lock;
  73. unsigned int __futex;
  74. __extension__ unsigned long long int __total_seq;
  75. __extension__ unsigned long long int __wakeup_seq;
  76. __extension__ unsigned long long int __woken_seq;
  77. void *__mutex;
  78. unsigned int __nwaiters;
  79. unsigned int __broadcast_seq;
  80. } __data;
  81. char __size[__SIZEOF_PTHREAD_COND_T];
  82. __extension__ long long int __align;
  83. } pthread_cond_t;
  84. typedef union
  85. {
  86. char __size[__SIZEOF_PTHREAD_CONDATTR_T];
  87. int __align;
  88. } pthread_condattr_t;
  89. /* Keys for thread-specific data */
  90. typedef unsigned int pthread_key_t;
  91. /* Once-only execution */
  92. typedef int pthread_once_t;
  93. #if defined __USE_UNIX98 || defined __USE_XOPEN2K
  94. /* Data structure for read-write lock variable handling. The
  95. structure of the attribute type is not exposed on purpose. */
  96. typedef union
  97. {
  98. struct
  99. {
  100. int __lock;
  101. unsigned int __nr_readers;
  102. unsigned int __readers_wakeup;
  103. unsigned int __writer_wakeup;
  104. unsigned int __nr_readers_queued;
  105. unsigned int __nr_writers_queued;
  106. int __writer;
  107. int __shared;
  108. unsigned long int __pad1;
  109. unsigned long int __pad2;
  110. unsigned int __flags;
  111. } __data;
  112. char __size[__SIZEOF_PTHREAD_RWLOCK_T];
  113. long int __align;
  114. } pthread_rwlock_t;
  115. #define __PTHREAD_RWLOCK_ELISION_EXTRA 0
  116. typedef union
  117. {
  118. char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
  119. long int __align;
  120. } pthread_rwlockattr_t;
  121. #endif
  122. #ifdef __USE_XOPEN2K
  123. /* POSIX spinlock data type. */
  124. typedef volatile int pthread_spinlock_t;
  125. /* POSIX barriers data type. The structure of the type is
  126. deliberately not exposed. */
  127. typedef union
  128. {
  129. char __size[__SIZEOF_PTHREAD_BARRIER_T];
  130. long int __align;
  131. } pthread_barrier_t;
  132. typedef union
  133. {
  134. char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
  135. int __align;
  136. } pthread_barrierattr_t;
  137. #endif
  138. #endif /* bits/pthreadtypes.h */