gccxml_gem 0.9.3-x86-darwin-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. data/Rakefile +84 -0
  2. data/bin/gccxml +0 -0
  3. data/bin/gccxml_cc1plus +0 -0
  4. data/gccxml.rb +57 -0
  5. data/share/doc/gccxml-0.9/Copyright.txt +55 -0
  6. data/share/doc/gccxml-0.9/gccxml.html +168 -0
  7. data/share/doc/gccxml-0.9/gccxml.txt +293 -0
  8. data/share/gccxml-0.9/GCC/2.95/algorithm +76 -0
  9. data/share/gccxml-0.9/GCC/2.95/bitset +17 -0
  10. data/share/gccxml-0.9/GCC/2.95/cctype +24 -0
  11. data/share/gccxml-0.9/GCC/2.95/clocale +14 -0
  12. data/share/gccxml-0.9/GCC/2.95/cmath +33 -0
  13. data/share/gccxml-0.9/GCC/2.95/complex +38 -0
  14. data/share/gccxml-0.9/GCC/2.95/csetjmp +13 -0
  15. data/share/gccxml-0.9/GCC/2.95/csignal +14 -0
  16. data/share/gccxml-0.9/GCC/2.95/cstdarg +12 -0
  17. data/share/gccxml-0.9/GCC/2.95/cstddef +13 -0
  18. data/share/gccxml-0.9/GCC/2.95/cstdio +55 -0
  19. data/share/gccxml-0.9/GCC/2.95/cstdlib +66 -0
  20. data/share/gccxml-0.9/GCC/2.95/cstring +34 -0
  21. data/share/gccxml-0.9/GCC/2.95/ctime +24 -0
  22. data/share/gccxml-0.9/GCC/2.95/cwchar +65 -0
  23. data/share/gccxml-0.9/GCC/2.95/cwctype +31 -0
  24. data/share/gccxml-0.9/GCC/2.95/deque +19 -0
  25. data/share/gccxml-0.9/GCC/2.95/exception +20 -0
  26. data/share/gccxml-0.9/GCC/2.95/fstream +23 -0
  27. data/share/gccxml-0.9/GCC/2.95/functional +64 -0
  28. data/share/gccxml-0.9/GCC/2.95/gccxml_bitset +1066 -0
  29. data/share/gccxml-0.9/GCC/2.95/iomanip +20 -0
  30. data/share/gccxml-0.9/GCC/2.95/iosfwd +20 -0
  31. data/share/gccxml-0.9/GCC/2.95/iostream +27 -0
  32. data/share/gccxml-0.9/GCC/2.95/iterator +39 -0
  33. data/share/gccxml-0.9/GCC/2.95/list +19 -0
  34. data/share/gccxml-0.9/GCC/2.95/map +20 -0
  35. data/share/gccxml-0.9/GCC/2.95/memory +21 -0
  36. data/share/gccxml-0.9/GCC/2.95/new +13 -0
  37. data/share/gccxml-0.9/GCC/2.95/numeric +15 -0
  38. data/share/gccxml-0.9/GCC/2.95/pthread.h +16 -0
  39. data/share/gccxml-0.9/GCC/2.95/queue +20 -0
  40. data/share/gccxml-0.9/GCC/2.95/set +20 -0
  41. data/share/gccxml-0.9/GCC/2.95/sstream +24 -0
  42. data/share/gccxml-0.9/GCC/2.95/stack +19 -0
  43. data/share/gccxml-0.9/GCC/2.95/std/bastring.cc +524 -0
  44. data/share/gccxml-0.9/GCC/2.95/std/complext.h +397 -0
  45. data/share/gccxml-0.9/GCC/2.95/std/dcomplex.h +92 -0
  46. data/share/gccxml-0.9/GCC/2.95/std/fcomplex.h +88 -0
  47. data/share/gccxml-0.9/GCC/2.95/std/gslice_array.h +170 -0
  48. data/share/gccxml-0.9/GCC/2.95/std/indirect_array.h +157 -0
  49. data/share/gccxml-0.9/GCC/2.95/std/ldcomplex.h +96 -0
  50. data/share/gccxml-0.9/GCC/2.95/std/mask_array.h +154 -0
  51. data/share/gccxml-0.9/GCC/2.95/std/slice_array.h +156 -0
  52. data/share/gccxml-0.9/GCC/2.95/std/std_valarray.h +728 -0
  53. data/share/gccxml-0.9/GCC/2.95/std/straits.h +162 -0
  54. data/share/gccxml-0.9/GCC/2.95/std/valarray_meta.h +1035 -0
  55. data/share/gccxml-0.9/GCC/2.95/stdexcept +17 -0
  56. data/share/gccxml-0.9/GCC/2.95/stl_alloc.h +1057 -0
  57. data/share/gccxml-0.9/GCC/2.95/stl_bvector.h +836 -0
  58. data/share/gccxml-0.9/GCC/2.95/stl_deque.h +1699 -0
  59. data/share/gccxml-0.9/GCC/2.95/stl_list.h +843 -0
  60. data/share/gccxml-0.9/GCC/2.95/stl_tree.h +1331 -0
  61. data/share/gccxml-0.9/GCC/2.95/stl_vector.h +828 -0
  62. data/share/gccxml-0.9/GCC/2.95/string +26 -0
  63. data/share/gccxml-0.9/GCC/2.95/strstream +23 -0
  64. data/share/gccxml-0.9/GCC/2.95/typeinfo +11 -0
  65. data/share/gccxml-0.9/GCC/2.95/utility +25 -0
  66. data/share/gccxml-0.9/GCC/2.95/valarray +52 -0
  67. data/share/gccxml-0.9/GCC/2.95/vector +19 -0
  68. data/share/gccxml-0.9/GCC/2.96/sstream +305 -0
  69. data/share/gccxml-0.9/GCC/3.0/pthread.h +16 -0
  70. data/share/gccxml-0.9/GCC/3.1/pthread.h +16 -0
  71. data/share/gccxml-0.9/GCC/3.2/bits/fstream.tcc +500 -0
  72. data/share/gccxml-0.9/GCC/3.2/bits/gthr-default.h +585 -0
  73. data/share/gccxml-0.9/GCC/3.2/bits/istream.tcc +1207 -0
  74. data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.h +1810 -0
  75. data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.tcc +2397 -0
  76. data/share/gccxml-0.9/GCC/3.2/bits/messages_members.h +108 -0
  77. data/share/gccxml-0.9/GCC/3.2/bits/ostream.tcc +713 -0
  78. data/share/gccxml-0.9/GCC/3.2/bits/sstream.tcc +241 -0
  79. data/share/gccxml-0.9/GCC/3.2/bits/stl_deque.h +1682 -0
  80. data/share/gccxml-0.9/GCC/3.2/bits/stl_list.h +989 -0
  81. data/share/gccxml-0.9/GCC/3.2/bits/stl_tree.h +1462 -0
  82. data/share/gccxml-0.9/GCC/3.2/bits/stl_vector.h +1085 -0
  83. data/share/gccxml-0.9/GCC/3.2/bits/valarray_meta.h +1063 -0
  84. data/share/gccxml-0.9/GCC/3.2/fstream +579 -0
  85. data/share/gccxml-0.9/GCC/3.2/pthread.h +16 -0
  86. data/share/gccxml-0.9/GCC/3.2/sstream +384 -0
  87. data/share/gccxml-0.9/GCC/3.3/bits/fstream.tcc +530 -0
  88. data/share/gccxml-0.9/GCC/3.3/bits/list.tcc +378 -0
  89. data/share/gccxml-0.9/GCC/3.3/bits/locale_facets.h +2050 -0
  90. data/share/gccxml-0.9/GCC/3.3/bits/messages_members.h +108 -0
  91. data/share/gccxml-0.9/GCC/3.3/bits/sstream.tcc +243 -0
  92. data/share/gccxml-0.9/GCC/3.3/bits/stl_deque.h +1603 -0
  93. data/share/gccxml-0.9/GCC/3.3/bits/stl_list.h +1167 -0
  94. data/share/gccxml-0.9/GCC/3.3/bits/stl_tree.h +1462 -0
  95. data/share/gccxml-0.9/GCC/3.3/bits/stl_vector.h +992 -0
  96. data/share/gccxml-0.9/GCC/3.3/bits/valarray_meta.h +1135 -0
  97. data/share/gccxml-0.9/GCC/3.3/fstream +842 -0
  98. data/share/gccxml-0.9/GCC/3.3/gccxml_builtins.h +22 -0
  99. data/share/gccxml-0.9/GCC/3.3/sstream +638 -0
  100. data/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h +669 -0
  101. data/share/gccxml-0.9/GCC/3.4/gccxml_builtins.h +91 -0
  102. data/share/gccxml-0.9/GCC/4.0/emmintrin.h +5 -0
  103. data/share/gccxml-0.9/GCC/4.0/gccxml_apple_emmintrin.h +1037 -0
  104. data/share/gccxml-0.9/GCC/4.0/gccxml_apple_mmintrin.h +669 -0
  105. data/share/gccxml-0.9/GCC/4.0/gccxml_apple_xmmintrin.h +870 -0
  106. data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
  107. data/share/gccxml-0.9/GCC/4.0/gccxml_gnu_emmintrin.h +977 -0
  108. data/share/gccxml-0.9/GCC/4.0/gccxml_gnu_mmintrin.h +636 -0
  109. data/share/gccxml-0.9/GCC/4.0/gccxml_gnu_xmmintrin.h +833 -0
  110. data/share/gccxml-0.9/GCC/4.0/mmintrin.h +5 -0
  111. data/share/gccxml-0.9/GCC/4.0/xmmintrin.h +5 -0
  112. data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +622 -0
  113. data/share/gccxml-0.9/GCC/4.1/emmintrin.h +5 -0
  114. data/share/gccxml-0.9/GCC/4.1/gccxml_apple_emmintrin.h +1509 -0
  115. data/share/gccxml-0.9/GCC/4.1/gccxml_apple_mmintrin.h +942 -0
  116. data/share/gccxml-0.9/GCC/4.1/gccxml_apple_xmmintrin.h +1192 -0
  117. data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
  118. data/share/gccxml-0.9/GCC/4.1/gccxml_gnu_emmintrin.h +1004 -0
  119. data/share/gccxml-0.9/GCC/4.1/gccxml_gnu_mmintrin.h +637 -0
  120. data/share/gccxml-0.9/GCC/4.1/gccxml_gnu_xmmintrin.h +834 -0
  121. data/share/gccxml-0.9/GCC/4.1/mmintrin.h +5 -0
  122. data/share/gccxml-0.9/GCC/4.1/xmmintrin.h +5 -0
  123. data/share/gccxml-0.9/GCC/4.2/emmintrin.h +5 -0
  124. data/share/gccxml-0.9/GCC/4.2/gccxml_apple_emmintrin.h +1509 -0
  125. data/share/gccxml-0.9/GCC/4.2/gccxml_apple_mmintrin.h +942 -0
  126. data/share/gccxml-0.9/GCC/4.2/gccxml_apple_xmmintrin.h +1192 -0
  127. data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
  128. data/share/gccxml-0.9/GCC/4.2/gccxml_gnu_emmintrin.h +1013 -0
  129. data/share/gccxml-0.9/GCC/4.2/gccxml_gnu_mmintrin.h +663 -0
  130. data/share/gccxml-0.9/GCC/4.2/gccxml_gnu_xmmintrin.h +860 -0
  131. data/share/gccxml-0.9/GCC/4.2/mmintrin.h +5 -0
  132. data/share/gccxml-0.9/GCC/4.2/xmmintrin.h +5 -0
  133. data/share/gccxml-0.9/GCC/4.3/emmintrin.h +1043 -0
  134. data/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h +183 -0
  135. data/share/gccxml-0.9/GCC/4.3/mmintrin.h +663 -0
  136. data/share/gccxml-0.9/GCC/4.3/xmmintrin.h +867 -0
  137. data/share/gccxml-0.9/GCC/4.4/bits/c++config.h +1431 -0
  138. data/share/gccxml-0.9/GCC/4.4/emmintrin.h +1041 -0
  139. data/share/gccxml-0.9/GCC/4.4/gccxml_builtins.h +153 -0
  140. data/share/gccxml-0.9/GCC/4.4/mmintrin.h +662 -0
  141. data/share/gccxml-0.9/GCC/4.4/xmmintrin.h +864 -0
  142. data/share/gccxml-0.9/GCC/4.5/gccxml_builtins.h +154 -0
  143. data/share/gccxml-0.9/GCC/4.5/iomanip +349 -0
  144. data/share/gccxml-0.9/GCC/COPYING.RUNTIME +73 -0
  145. data/share/gccxml-0.9/GCC/COPYING3 +674 -0
  146. data/share/gccxml-0.9/IBM/8.0/adapt_headers.sh +34 -0
  147. data/share/gccxml-0.9/IBM/8.0/stdlib.h.patch +27 -0
  148. data/share/gccxml-0.9/IBM/8.0/xstring.patch +19 -0
  149. data/share/gccxml-0.9/IBM/README +8 -0
  150. data/share/gccxml-0.9/IBM/find_flags +51 -0
  151. data/share/gccxml-0.9/IBM/find_flags_common +48 -0
  152. data/share/gccxml-0.9/Intel/find_flags +56 -0
  153. data/share/gccxml-0.9/Intel/pthread.h +16 -0
  154. data/share/gccxml-0.9/MIPSpro/7.3/exception +9 -0
  155. data/share/gccxml-0.9/MIPSpro/7.3/gccxml_mpro_internals.h +21 -0
  156. data/share/gccxml-0.9/MIPSpro/7.3/iomanip +161 -0
  157. data/share/gccxml-0.9/MIPSpro/7.3/ostream +9 -0
  158. data/share/gccxml-0.9/MIPSpro/7.3/stddef.h +9 -0
  159. data/share/gccxml-0.9/MIPSpro/7.3/stl_config.h +9 -0
  160. data/share/gccxml-0.9/MIPSpro/7.3/stl_locale.h +17 -0
  161. data/share/gccxml-0.9/MIPSpro/7.3/stl_monetary.h +14 -0
  162. data/share/gccxml-0.9/MIPSpro/7.3/stl_numeric_facets.h +13 -0
  163. data/share/gccxml-0.9/MIPSpro/7.3/stl_threads.h +11 -0
  164. data/share/gccxml-0.9/MIPSpro/7.3/string +18 -0
  165. data/share/gccxml-0.9/MIPSpro/find_flags +70 -0
  166. data/share/gccxml-0.9/MIPSpro/mipspro_defs.cxx +63 -0
  167. data/share/gccxml-0.9/Sun/5.8/Cstd.patch +156 -0
  168. data/share/gccxml-0.9/Sun/5.8/adapt_headers.sh +32 -0
  169. data/share/gccxml-0.9/Sun/5.8/std-5.10.patch +22 -0
  170. data/share/gccxml-0.9/Sun/README +8 -0
  171. data/share/gccxml-0.9/Sun/find_flags +51 -0
  172. data/share/gccxml-0.9/Sun/find_flags_common +42 -0
  173. data/share/gccxml-0.9/gccxml_config +2 -0
  174. data/share/gccxml-0.9/gccxml_identify_compiler.cc +13 -0
  175. data/share/man/man1/gccxml.1 +246 -0
  176. metadata +243 -0
@@ -0,0 +1,669 @@
1
+ #if defined(__MINGW32__)
2
+ # include_next <bits/gthr-default.h>
3
+ #else
4
+ /* Threads compatibility routines for libgcc2 and libobjc. */
5
+ /* Compile this one with gcc. */
6
+ /* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003
7
+ Free Software Foundation, Inc.
8
+
9
+ This file is part of GCC.
10
+
11
+ GCC is free software; you can redistribute it and/or modify it under
12
+ the terms of the GNU General Public License as published by the Free
13
+ Software Foundation; either version 2, or (at your option) any later
14
+ version.
15
+
16
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
17
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
+ for more details.
20
+
21
+ You should have received a copy of the GNU General Public License
22
+ along with GCC; see the file COPYING. If not, write to the Free
23
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24
+ 02111-1307, USA. */
25
+
26
+ /* As a special exception, if you link this library with other files,
27
+ some of which are compiled with GCC, to produce an executable,
28
+ this library does not by itself cause the resulting executable
29
+ to be covered by the GNU General Public License.
30
+ This exception does not however invalidate any other reasons why
31
+ the executable file might be covered by the GNU General Public License. */
32
+
33
+ #ifndef _GLIBCXX_GCC_GTHR_POSIX_H
34
+ #define _GLIBCXX_GCC_GTHR_POSIX_H
35
+
36
+ /* POSIX threads specific definitions.
37
+ Easy, since the interface is just one-to-one mapping. */
38
+
39
+ #define __GTHREADS 1
40
+
41
+ /* Some implementations of <pthread.h> require this to be defined. */
42
+ #if !defined(_REENTRANT) && defined(__osf__)
43
+ #define _REENTRANT 1
44
+ #endif
45
+
46
+ #include <pthread.h>
47
+ #include <unistd.h>
48
+
49
+ typedef pthread_key_t __gthread_key_t;
50
+ typedef pthread_once_t __gthread_once_t;
51
+ typedef pthread_mutex_t __gthread_mutex_t;
52
+ typedef pthread_mutex_t __gthread_recursive_mutex_t;
53
+
54
+ #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
55
+ #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
56
+ #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
57
+ #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
58
+ #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
59
+ #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
60
+ #else
61
+ #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
62
+ #endif
63
+
64
+ #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK && defined __GNUC_RH_RELEASE__ \
65
+ && ((__GNUC__ == 3 && __GNUC_MINOR__ == 4 && (__GNUC_PATCHLEVEL__ > 4 || (__GNUC_PATCHLEVEL__ == 4 && __GNUC_RH_RELEASE__ > 2))) \
66
+ || (__GNUC__ == 4 && __GNUC_MINOR__ == 0 && (__GNUC_PATCHLEVEL__ > 2 || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ > 6)))) \
67
+ && ! defined __attribute__
68
+ # define __gthrw(name) \
69
+ extern __typeof(name) __gthrw_ ## name
70
+
71
+
72
+ __gthrw(pthread_once);
73
+ __gthrw(pthread_key_create);
74
+ __gthrw(pthread_key_delete);
75
+ __gthrw(pthread_getspecific);
76
+ __gthrw(pthread_setspecific);
77
+ __gthrw(pthread_create);
78
+
79
+ __gthrw(pthread_mutex_lock);
80
+ __gthrw(pthread_mutex_trylock);
81
+ __gthrw(pthread_mutex_unlock);
82
+ __gthrw(pthread_mutexattr_init);
83
+ __gthrw(pthread_mutexattr_settype);
84
+ __gthrw(pthread_mutexattr_destroy);
85
+
86
+ __gthrw(pthread_mutex_init);
87
+
88
+ # if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
89
+ /* Objective-C. */
90
+ __gthrw(pthread_cond_broadcast);
91
+ __gthrw(pthread_cond_destroy);
92
+ __gthrw(pthread_cond_init);
93
+ __gthrw(pthread_cond_signal);
94
+ __gthrw(pthread_cond_wait);
95
+ __gthrw(pthread_exit);
96
+ __gthrw(pthread_mutex_destroy);
97
+ __gthrw(pthread_self);
98
+ /* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but
99
+ we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */
100
+ # ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
101
+ __gthrw(sched_get_priority_max);
102
+ __gthrw(sched_get_priority_min);
103
+ # endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
104
+ __gthrw(sched_yield);
105
+ __gthrw(pthread_attr_destroy);
106
+ __gthrw(pthread_attr_init);
107
+ __gthrw(pthread_attr_setdetachstate);
108
+ # ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
109
+ __gthrw(pthread_getschedparam);
110
+ __gthrw(pthread_setschedparam);
111
+ # endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
112
+ # endif /* _LIBOBJC || _LIBOBJC_WEAK */
113
+ #else
114
+ # if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
115
+ #pragma weak pthread_once
116
+ #pragma weak pthread_key_create
117
+ #pragma weak pthread_key_delete
118
+ #pragma weak pthread_getspecific
119
+ #pragma weak pthread_setspecific
120
+ #pragma weak pthread_create
121
+
122
+ #pragma weak pthread_mutex_lock
123
+ #pragma weak pthread_mutex_trylock
124
+ #pragma weak pthread_mutex_unlock
125
+ #pragma weak pthread_mutexattr_init
126
+ #pragma weak pthread_mutexattr_settype
127
+ #pragma weak pthread_mutexattr_destroy
128
+
129
+ #pragma weak pthread_mutex_init
130
+
131
+ #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
132
+ /* Objective-C. */
133
+ #pragma weak pthread_cond_broadcast
134
+ #pragma weak pthread_cond_destroy
135
+ #pragma weak pthread_cond_init
136
+ #pragma weak pthread_cond_signal
137
+ #pragma weak pthread_cond_wait
138
+ #pragma weak pthread_exit
139
+ #pragma weak pthread_mutex_destroy
140
+ #pragma weak pthread_self
141
+ /* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but
142
+ we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */
143
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
144
+ #pragma weak sched_get_priority_max
145
+ #pragma weak sched_get_priority_min
146
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
147
+ #pragma weak sched_yield
148
+ #pragma weak pthread_attr_destroy
149
+ #pragma weak pthread_attr_init
150
+ #pragma weak pthread_attr_setdetachstate
151
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
152
+ #pragma weak pthread_getschedparam
153
+ #pragma weak pthread_setschedparam
154
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
155
+ #endif /* _LIBOBJC || _LIBOBJC_WEAK */
156
+ #endif /* __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK */
157
+
158
+ #define __gthrw_pthread_once pthread_once
159
+ #define __gthrw_pthread_key_create pthread_key_create
160
+ #define __gthrw_pthread_key_delete pthread_key_delete
161
+ #define __gthrw_pthread_getspecific pthread_getspecific
162
+ #define __gthrw_pthread_setspecific pthread_setspecific
163
+ #define __gthrw_pthread_create pthread_create
164
+
165
+ #define __gthrw_pthread_mutex_lock pthread_mutex_lock
166
+ #define __gthrw_pthread_mutex_trylock pthread_mutex_trylock
167
+ #define __gthrw_pthread_mutex_unlock pthread_mutex_unlock
168
+ #define __gthrw_pthread_mutexattr_init pthread_mutexattr_init
169
+ #define __gthrw_pthread_mutexattr_settype pthread_mutexattr_settype
170
+ #define __gthrw_pthread_mutexattr_destroy pthread_mutexattr_destroy
171
+
172
+ #define __gthrw_pthread_mutex_init pthread_mutex_init
173
+
174
+ #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
175
+ /* Objective-C. */
176
+ #define __gthrw_pthread_cond_broadcast pthread_cond_broadcast
177
+ #define __gthrw_pthread_cond_destroy pthread_cond_destroy
178
+ #define __gthrw_pthread_cond_init pthread_cond_init
179
+ #define __gthrw_pthread_cond_signal pthread_cond_signal
180
+ #define __gthrw_pthread_cond_wait pthread_cond_wait
181
+ #define __gthrw_pthread_exit pthread_exit
182
+ #define __gthrw_pthread_mutex_destroy pthread_mutex_destroy
183
+ #define __gthrw_pthread_self pthread_self
184
+ /* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but
185
+ we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */
186
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
187
+ #define __gthrw_sched_get_priority_max sched_get_priority_max
188
+ #define __gthrw_sched_get_priority_min sched_get_priority_min
189
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
190
+ #define __gthrw_sched_yield sched_yield
191
+ #define __gthrw_pthread_attr_destroy pthread_attr_destroy
192
+ #define __gthrw_pthread_attr_init pthread_attr_init
193
+ #define __gthrw_pthread_attr_setdetachstate pthread_attr_setdetachstate
194
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
195
+ #define __gthrw_pthread_getschedparam pthread_getschedparam
196
+ #define __gthrw_pthread_setschedparam pthread_setschedparam
197
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
198
+ #endif /* _LIBOBJC || _LIBOBJC_WEAK */
199
+ #endif
200
+
201
+
202
+ #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
203
+
204
+ static inline int
205
+ __gthread_active_p (void)
206
+ {
207
+ static void *const __gthread_active_ptr = (void *) &__gthrw_pthread_create;
208
+ return __gthread_active_ptr != 0;
209
+ }
210
+
211
+ #else /* not __GXX_WEAK__ */
212
+
213
+ static inline int
214
+ __gthread_active_p (void)
215
+ {
216
+ return 1;
217
+ }
218
+
219
+ #endif /* __GXX_WEAK__ */
220
+
221
+ #ifdef _LIBOBJC
222
+
223
+ /* This is the config.h file in libobjc/ */
224
+ #include <config.h>
225
+
226
+ #ifdef HAVE_SCHED_H
227
+ # include <sched.h>
228
+ #endif
229
+
230
+ /* Key structure for maintaining thread specific storage */
231
+ static pthread_key_t _objc_thread_storage;
232
+ static pthread_attr_t _objc_thread_attribs;
233
+
234
+ /* Thread local storage for a single thread */
235
+ static void *thread_local_storage = NULL;
236
+
237
+ /* Backend initialization functions */
238
+
239
+ /* Initialize the threads subsystem. */
240
+ static inline int
241
+ __gthread_objc_init_thread_system (void)
242
+ {
243
+ if (__gthread_active_p ())
244
+ {
245
+ /* Initialize the thread storage key */
246
+ if (__gthrw_pthread_key_create (&_objc_thread_storage, NULL) == 0)
247
+ {
248
+ /* The normal default detach state for threads is
249
+ * PTHREAD_CREATE_JOINABLE which causes threads to not die
250
+ * when you think they should. */
251
+ if (__gthrw_pthread_attr_init (&_objc_thread_attribs) == 0
252
+ && __gthrw_pthread_attr_setdetachstate (&_objc_thread_attribs,
253
+ PTHREAD_CREATE_DETACHED) == 0)
254
+ return 0;
255
+ }
256
+ }
257
+
258
+ return -1;
259
+ }
260
+
261
+ /* Close the threads subsystem. */
262
+ static inline int
263
+ __gthread_objc_close_thread_system (void)
264
+ {
265
+ if (__gthread_active_p ()
266
+ && __gthrw_pthread_key_delete (_objc_thread_storage) == 0
267
+ && __gthrw_pthread_attr_destroy (&_objc_thread_attribs) == 0)
268
+ return 0;
269
+
270
+ return -1;
271
+ }
272
+
273
+ /* Backend thread functions */
274
+
275
+ /* Create a new thread of execution. */
276
+ static inline objc_thread_t
277
+ __gthread_objc_thread_detach (void (*func)(void *), void *arg)
278
+ {
279
+ objc_thread_t thread_id;
280
+ pthread_t new_thread_handle;
281
+
282
+ if (!__gthread_active_p ())
283
+ return NULL;
284
+
285
+ if (!(__gthrw_pthread_create (&new_thread_handle, NULL, (void *) func, arg)))
286
+ thread_id = (objc_thread_t) new_thread_handle;
287
+ else
288
+ thread_id = NULL;
289
+
290
+ return thread_id;
291
+ }
292
+
293
+ /* Set the current thread's priority. */
294
+ static inline int
295
+ __gthread_objc_thread_set_priority (int priority)
296
+ {
297
+ if (!__gthread_active_p ())
298
+ return -1;
299
+ else
300
+ {
301
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
302
+ pthread_t thread_id = __gthrw_pthread_self ();
303
+ int policy;
304
+ struct sched_param params;
305
+ int priority_min, priority_max;
306
+
307
+ if (__gthrw_pthread_getschedparam (thread_id, &policy, &params) == 0)
308
+ {
309
+ if ((priority_max = __gthrw_sched_get_priority_max (policy)) == -1)
310
+ return -1;
311
+
312
+ if ((priority_min = __gthrw_sched_get_priority_min (policy)) == -1)
313
+ return -1;
314
+
315
+ if (priority > priority_max)
316
+ priority = priority_max;
317
+ else if (priority < priority_min)
318
+ priority = priority_min;
319
+ params.sched_priority = priority;
320
+
321
+ /*
322
+ * The solaris 7 and several other man pages incorrectly state that
323
+ * this should be a pointer to policy but pthread.h is universally
324
+ * at odds with this.
325
+ */
326
+ if (__gthrw_pthread_setschedparam (thread_id, policy, &params) == 0)
327
+ return 0;
328
+ }
329
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
330
+ return -1;
331
+ }
332
+ }
333
+
334
+ /* Return the current thread's priority. */
335
+ static inline int
336
+ __gthread_objc_thread_get_priority (void)
337
+ {
338
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
339
+ if (__gthread_active_p ())
340
+ {
341
+ int policy;
342
+ struct sched_param params;
343
+
344
+ if (__gthrw_pthread_getschedparam (__gthrw_pthread_self (), &policy, &params) == 0)
345
+ return params.sched_priority;
346
+ else
347
+ return -1;
348
+ }
349
+ else
350
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
351
+ return OBJC_THREAD_INTERACTIVE_PRIORITY;
352
+ }
353
+
354
+ /* Yield our process time to another thread. */
355
+ static inline void
356
+ __gthread_objc_thread_yield (void)
357
+ {
358
+ if (__gthread_active_p ())
359
+ __gthrw_sched_yield ();
360
+ }
361
+
362
+ /* Terminate the current thread. */
363
+ static inline int
364
+ __gthread_objc_thread_exit (void)
365
+ {
366
+ if (__gthread_active_p ())
367
+ /* exit the thread */
368
+ __gthrw_pthread_exit (&__objc_thread_exit_status);
369
+
370
+ /* Failed if we reached here */
371
+ return -1;
372
+ }
373
+
374
+ /* Returns an integer value which uniquely describes a thread. */
375
+ static inline objc_thread_t
376
+ __gthread_objc_thread_id (void)
377
+ {
378
+ if (__gthread_active_p ())
379
+ return (objc_thread_t) __gthrw_pthread_self ();
380
+ else
381
+ return (objc_thread_t) 1;
382
+ }
383
+
384
+ /* Sets the thread's local storage pointer. */
385
+ static inline int
386
+ __gthread_objc_thread_set_data (void *value)
387
+ {
388
+ if (__gthread_active_p ())
389
+ return __gthrw_pthread_setspecific (_objc_thread_storage, value);
390
+ else
391
+ {
392
+ thread_local_storage = value;
393
+ return 0;
394
+ }
395
+ }
396
+
397
+ /* Returns the thread's local storage pointer. */
398
+ static inline void *
399
+ __gthread_objc_thread_get_data (void)
400
+ {
401
+ if (__gthread_active_p ())
402
+ return __gthrw_pthread_getspecific (_objc_thread_storage);
403
+ else
404
+ return thread_local_storage;
405
+ }
406
+
407
+ /* Backend mutex functions */
408
+
409
+ /* Allocate a mutex. */
410
+ static inline int
411
+ __gthread_objc_mutex_allocate (objc_mutex_t mutex)
412
+ {
413
+ if (__gthread_active_p ())
414
+ {
415
+ mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
416
+
417
+ if (__gthrw_pthread_mutex_init ((pthread_mutex_t *) mutex->backend, NULL))
418
+ {
419
+ objc_free (mutex->backend);
420
+ mutex->backend = NULL;
421
+ return -1;
422
+ }
423
+ }
424
+
425
+ return 0;
426
+ }
427
+
428
+ /* Deallocate a mutex. */
429
+ static inline int
430
+ __gthread_objc_mutex_deallocate (objc_mutex_t mutex)
431
+ {
432
+ if (__gthread_active_p ())
433
+ {
434
+ int count;
435
+
436
+ /*
437
+ * Posix Threads specifically require that the thread be unlocked
438
+ * for __gthrw_pthread_mutex_destroy to work.
439
+ */
440
+
441
+ do
442
+ {
443
+ count = __gthrw_pthread_mutex_unlock ((pthread_mutex_t *) mutex->backend);
444
+ if (count < 0)
445
+ return -1;
446
+ }
447
+ while (count);
448
+
449
+ if (__gthrw_pthread_mutex_destroy ((pthread_mutex_t *) mutex->backend))
450
+ return -1;
451
+
452
+ objc_free (mutex->backend);
453
+ mutex->backend = NULL;
454
+ }
455
+ return 0;
456
+ }
457
+
458
+ /* Grab a lock on a mutex. */
459
+ static inline int
460
+ __gthread_objc_mutex_lock (objc_mutex_t mutex)
461
+ {
462
+ if (__gthread_active_p ()
463
+ && __gthrw_pthread_mutex_lock ((pthread_mutex_t *) mutex->backend) != 0)
464
+ {
465
+ return -1;
466
+ }
467
+
468
+ return 0;
469
+ }
470
+
471
+ /* Try to grab a lock on a mutex. */
472
+ static inline int
473
+ __gthread_objc_mutex_trylock (objc_mutex_t mutex)
474
+ {
475
+ if (__gthread_active_p ()
476
+ && __gthrw_pthread_mutex_trylock ((pthread_mutex_t *) mutex->backend) != 0)
477
+ {
478
+ return -1;
479
+ }
480
+
481
+ return 0;
482
+ }
483
+
484
+ /* Unlock the mutex */
485
+ static inline int
486
+ __gthread_objc_mutex_unlock (objc_mutex_t mutex)
487
+ {
488
+ if (__gthread_active_p ()
489
+ && __gthrw_pthread_mutex_unlock ((pthread_mutex_t *) mutex->backend) != 0)
490
+ {
491
+ return -1;
492
+ }
493
+
494
+ return 0;
495
+ }
496
+
497
+ /* Backend condition mutex functions */
498
+
499
+ /* Allocate a condition. */
500
+ static inline int
501
+ __gthread_objc_condition_allocate (objc_condition_t condition)
502
+ {
503
+ if (__gthread_active_p ())
504
+ {
505
+ condition->backend = objc_malloc (sizeof (pthread_cond_t));
506
+
507
+ if (__gthrw_pthread_cond_init ((pthread_cond_t *) condition->backend, NULL))
508
+ {
509
+ objc_free (condition->backend);
510
+ condition->backend = NULL;
511
+ return -1;
512
+ }
513
+ }
514
+
515
+ return 0;
516
+ }
517
+
518
+ /* Deallocate a condition. */
519
+ static inline int
520
+ __gthread_objc_condition_deallocate (objc_condition_t condition)
521
+ {
522
+ if (__gthread_active_p ())
523
+ {
524
+ if (__gthrw_pthread_cond_destroy ((pthread_cond_t *) condition->backend))
525
+ return -1;
526
+
527
+ objc_free (condition->backend);
528
+ condition->backend = NULL;
529
+ }
530
+ return 0;
531
+ }
532
+
533
+ /* Wait on the condition */
534
+ static inline int
535
+ __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
536
+ {
537
+ if (__gthread_active_p ())
538
+ return __gthrw_pthread_cond_wait ((pthread_cond_t *) condition->backend,
539
+ (pthread_mutex_t *) mutex->backend);
540
+ else
541
+ return 0;
542
+ }
543
+
544
+ /* Wake up all threads waiting on this condition. */
545
+ static inline int
546
+ __gthread_objc_condition_broadcast (objc_condition_t condition)
547
+ {
548
+ if (__gthread_active_p ())
549
+ return __gthrw_pthread_cond_broadcast ((pthread_cond_t *) condition->backend);
550
+ else
551
+ return 0;
552
+ }
553
+
554
+ /* Wake up one thread waiting on this condition. */
555
+ static inline int
556
+ __gthread_objc_condition_signal (objc_condition_t condition)
557
+ {
558
+ if (__gthread_active_p ())
559
+ return __gthrw_pthread_cond_signal ((pthread_cond_t *) condition->backend);
560
+ else
561
+ return 0;
562
+ }
563
+
564
+ #else /* _LIBOBJC */
565
+
566
+ static inline int
567
+ __gthread_once (__gthread_once_t *once, void (*func) (void))
568
+ {
569
+ if (__gthread_active_p ())
570
+ return __gthrw_pthread_once (once, func);
571
+ else
572
+ return -1;
573
+ }
574
+
575
+ static inline int
576
+ __gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
577
+ {
578
+ return __gthrw_pthread_key_create (key, dtor);
579
+ }
580
+
581
+ static inline int
582
+ __gthread_key_delete (__gthread_key_t key)
583
+ {
584
+ return __gthrw_pthread_key_delete (key);
585
+ }
586
+
587
+ static inline void *
588
+ __gthread_getspecific (__gthread_key_t key)
589
+ {
590
+ return __gthrw_pthread_getspecific (key);
591
+ }
592
+
593
+ static inline int
594
+ __gthread_setspecific (__gthread_key_t key, const void *ptr)
595
+ {
596
+ return __gthrw_pthread_setspecific (key, ptr);
597
+ }
598
+
599
+ static inline int
600
+ __gthread_mutex_lock (__gthread_mutex_t *mutex)
601
+ {
602
+ if (__gthread_active_p ())
603
+ return __gthrw_pthread_mutex_lock (mutex);
604
+ else
605
+ return 0;
606
+ }
607
+
608
+ static inline int
609
+ __gthread_mutex_trylock (__gthread_mutex_t *mutex)
610
+ {
611
+ if (__gthread_active_p ())
612
+ return __gthrw_pthread_mutex_trylock (mutex);
613
+ else
614
+ return 0;
615
+ }
616
+
617
+ static inline int
618
+ __gthread_mutex_unlock (__gthread_mutex_t *mutex)
619
+ {
620
+ if (__gthread_active_p ())
621
+ return __gthrw_pthread_mutex_unlock (mutex);
622
+ else
623
+ return 0;
624
+ }
625
+
626
+ #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
627
+ static inline int
628
+ __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
629
+ {
630
+ if (__gthread_active_p ())
631
+ {
632
+ pthread_mutexattr_t attr;
633
+ int r;
634
+
635
+ r = __gthrw_pthread_mutexattr_init (&attr);
636
+ if (!r)
637
+ r = __gthrw_pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
638
+ if (!r)
639
+ r = __gthrw_pthread_mutex_init (mutex, &attr);
640
+ if (!r)
641
+ r = __gthrw_pthread_mutexattr_destroy (&attr);
642
+ return r;
643
+ }
644
+ }
645
+ #endif
646
+
647
+ static inline int
648
+ __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
649
+ {
650
+ return __gthread_mutex_lock (mutex);
651
+ }
652
+
653
+ static inline int
654
+ __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
655
+ {
656
+ return __gthread_mutex_trylock (mutex);
657
+ }
658
+
659
+ static inline int
660
+ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
661
+ {
662
+ return __gthread_mutex_unlock (mutex);
663
+ }
664
+
665
+ #endif /* _LIBOBJC */
666
+
667
+ #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
668
+ #endif
669
+