gccxml_gem 0.9.3-x86-darwin-10

Sign up to get free protection for your applications and to get access to all the features.
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 +245 -0
@@ -0,0 +1,5 @@
1
+ #ifdef __APPLE__
2
+ # include "gccxml_apple_mmintrin.h"
3
+ #else
4
+ # include "gccxml_gnu_mmintrin.h"
5
+ #endif
@@ -0,0 +1,5 @@
1
+ #ifdef __APPLE__
2
+ # include "gccxml_apple_xmmintrin.h"
3
+ #else
4
+ # include "gccxml_gnu_xmmintrin.h"
5
+ #endif
@@ -0,0 +1,622 @@
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, 2004, 2005, 2006, 2007
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, 51 Franklin Street, Fifth Floor, Boston, MA
24
+ 02110-1301, 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 && 0
65
+ # ifndef __gthrw_pragma
66
+ # define __gthrw_pragma(pragma)
67
+ # endif
68
+ # define __gthrw2(name,name2,type) \
69
+ extern __typeof(type) name __attribute__ ((__weakref__(#name2))); \
70
+ __gthrw_pragma(weak type)
71
+ # define __gthrw_(name) __gthrw_ ## name
72
+ #else
73
+ # define __gthrw2(name,name2,type)
74
+ # define __gthrw_(name) name
75
+ #endif
76
+
77
+ /* Typically, __gthrw_foo is a weak reference to symbol foo. */
78
+ #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
79
+
80
+ /* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
81
+ map a subset of the POSIX pthread API to mangled versions of their
82
+ names. */
83
+ #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
84
+ #define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
85
+ __gthrw3(pthread_once)
86
+ __gthrw3(pthread_getspecific)
87
+ __gthrw3(pthread_setspecific)
88
+ __gthrw3(pthread_create)
89
+ __gthrw3(pthread_cancel)
90
+ __gthrw3(pthread_mutex_lock)
91
+ __gthrw3(pthread_mutex_trylock)
92
+ __gthrw3(pthread_mutex_unlock)
93
+ __gthrw3(pthread_mutex_init)
94
+ #else
95
+ __gthrw(pthread_once)
96
+ __gthrw(pthread_getspecific)
97
+ __gthrw(pthread_setspecific)
98
+ __gthrw(pthread_create)
99
+ __gthrw(pthread_cancel)
100
+ __gthrw(pthread_mutex_lock)
101
+ __gthrw(pthread_mutex_trylock)
102
+ __gthrw(pthread_mutex_unlock)
103
+ __gthrw(pthread_mutex_init)
104
+ #endif
105
+
106
+ __gthrw(pthread_key_create)
107
+ __gthrw(pthread_key_delete)
108
+ __gthrw(pthread_mutexattr_init)
109
+ __gthrw(pthread_mutexattr_settype)
110
+ __gthrw(pthread_mutexattr_destroy)
111
+
112
+
113
+ #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
114
+ /* Objective-C. */
115
+ #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
116
+ __gthrw3(pthread_cond_broadcast)
117
+ __gthrw3(pthread_cond_destroy)
118
+ __gthrw3(pthread_cond_init)
119
+ __gthrw3(pthread_cond_signal)
120
+ __gthrw3(pthread_cond_wait)
121
+ __gthrw3(pthread_exit)
122
+ __gthrw3(pthread_mutex_destroy)
123
+ __gthrw3(pthread_self)
124
+ #else
125
+ __gthrw(pthread_cond_broadcast)
126
+ __gthrw(pthread_cond_destroy)
127
+ __gthrw(pthread_cond_init)
128
+ __gthrw(pthread_cond_signal)
129
+ __gthrw(pthread_cond_wait)
130
+ __gthrw(pthread_exit)
131
+ __gthrw(pthread_mutex_destroy)
132
+ __gthrw(pthread_self)
133
+ #endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
134
+ #ifdef _POSIX_PRIORITY_SCHEDULING
135
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
136
+ __gthrw(sched_get_priority_max)
137
+ __gthrw(sched_get_priority_min)
138
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
139
+ #endif /* _POSIX_PRIORITY_SCHEDULING */
140
+ __gthrw(sched_yield)
141
+ __gthrw(pthread_attr_destroy)
142
+ __gthrw(pthread_attr_init)
143
+ __gthrw(pthread_attr_setdetachstate)
144
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
145
+ __gthrw(pthread_getschedparam)
146
+ __gthrw(pthread_setschedparam)
147
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
148
+ #endif /* _LIBOBJC || _LIBOBJC_WEAK */
149
+
150
+ #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
151
+
152
+ static inline int
153
+ __gthread_active_p (void)
154
+ {
155
+ static void *const __gthread_active_ptr
156
+ = __extension__ (void *) &__gthrw_(pthread_cancel);
157
+ return __gthread_active_ptr != 0;
158
+ }
159
+
160
+ #else /* not __GXX_WEAK__ */
161
+
162
+ static inline int
163
+ __gthread_active_p (void)
164
+ {
165
+ return 1;
166
+ }
167
+
168
+ #endif /* __GXX_WEAK__ */
169
+
170
+ #ifdef _LIBOBJC
171
+
172
+ /* This is the config.h file in libobjc/ */
173
+ #include <config.h>
174
+
175
+ #ifdef HAVE_SCHED_H
176
+ # include <sched.h>
177
+ #endif
178
+
179
+ /* Key structure for maintaining thread specific storage */
180
+ static pthread_key_t _objc_thread_storage;
181
+ static pthread_attr_t _objc_thread_attribs;
182
+
183
+ /* Thread local storage for a single thread */
184
+ static void *thread_local_storage = NULL;
185
+
186
+ /* Backend initialization functions */
187
+
188
+ /* Initialize the threads subsystem. */
189
+ static inline int
190
+ __gthread_objc_init_thread_system (void)
191
+ {
192
+ if (__gthread_active_p ())
193
+ {
194
+ /* Initialize the thread storage key. */
195
+ if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
196
+ {
197
+ /* The normal default detach state for threads is
198
+ * PTHREAD_CREATE_JOINABLE which causes threads to not die
199
+ * when you think they should. */
200
+ if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
201
+ && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
202
+ PTHREAD_CREATE_DETACHED) == 0)
203
+ return 0;
204
+ }
205
+ }
206
+
207
+ return -1;
208
+ }
209
+
210
+ /* Close the threads subsystem. */
211
+ static inline int
212
+ __gthread_objc_close_thread_system (void)
213
+ {
214
+ if (__gthread_active_p ()
215
+ && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
216
+ && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
217
+ return 0;
218
+
219
+ return -1;
220
+ }
221
+
222
+ /* Backend thread functions */
223
+
224
+ /* Create a new thread of execution. */
225
+ static inline objc_thread_t
226
+ __gthread_objc_thread_detach (void (*func)(void *), void *arg)
227
+ {
228
+ objc_thread_t thread_id;
229
+ pthread_t new_thread_handle;
230
+
231
+ if (!__gthread_active_p ())
232
+ return NULL;
233
+
234
+ if (!(__gthrw_(pthread_create) (&new_thread_handle, NULL, (void *) func, arg)))
235
+ thread_id = (objc_thread_t) new_thread_handle;
236
+ else
237
+ thread_id = NULL;
238
+
239
+ return thread_id;
240
+ }
241
+
242
+ /* Set the current thread's priority. */
243
+ static inline int
244
+ __gthread_objc_thread_set_priority (int priority)
245
+ {
246
+ if (!__gthread_active_p ())
247
+ return -1;
248
+ else
249
+ {
250
+ #ifdef _POSIX_PRIORITY_SCHEDULING
251
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
252
+ pthread_t thread_id = __gthrw_(pthread_self) ();
253
+ int policy;
254
+ struct sched_param params;
255
+ int priority_min, priority_max;
256
+
257
+ if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
258
+ {
259
+ if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
260
+ return -1;
261
+
262
+ if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
263
+ return -1;
264
+
265
+ if (priority > priority_max)
266
+ priority = priority_max;
267
+ else if (priority < priority_min)
268
+ priority = priority_min;
269
+ params.sched_priority = priority;
270
+
271
+ /*
272
+ * The solaris 7 and several other man pages incorrectly state that
273
+ * this should be a pointer to policy but pthread.h is universally
274
+ * at odds with this.
275
+ */
276
+ if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
277
+ return 0;
278
+ }
279
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
280
+ #endif /* _POSIX_PRIORITY_SCHEDULING */
281
+ return -1;
282
+ }
283
+ }
284
+
285
+ /* Return the current thread's priority. */
286
+ static inline int
287
+ __gthread_objc_thread_get_priority (void)
288
+ {
289
+ #ifdef _POSIX_PRIORITY_SCHEDULING
290
+ #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
291
+ if (__gthread_active_p ())
292
+ {
293
+ int policy;
294
+ struct sched_param params;
295
+
296
+ if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
297
+ return params.sched_priority;
298
+ else
299
+ return -1;
300
+ }
301
+ else
302
+ #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
303
+ #endif /* _POSIX_PRIORITY_SCHEDULING */
304
+ return OBJC_THREAD_INTERACTIVE_PRIORITY;
305
+ }
306
+
307
+ /* Yield our process time to another thread. */
308
+ static inline void
309
+ __gthread_objc_thread_yield (void)
310
+ {
311
+ if (__gthread_active_p ())
312
+ __gthrw_(sched_yield) ();
313
+ }
314
+
315
+ /* Terminate the current thread. */
316
+ static inline int
317
+ __gthread_objc_thread_exit (void)
318
+ {
319
+ if (__gthread_active_p ())
320
+ /* exit the thread */
321
+ __gthrw_(pthread_exit) (&__objc_thread_exit_status);
322
+
323
+ /* Failed if we reached here */
324
+ return -1;
325
+ }
326
+
327
+ /* Returns an integer value which uniquely describes a thread. */
328
+ static inline objc_thread_t
329
+ __gthread_objc_thread_id (void)
330
+ {
331
+ if (__gthread_active_p ())
332
+ return (objc_thread_t) __gthrw_(pthread_self) ();
333
+ else
334
+ return (objc_thread_t) 1;
335
+ }
336
+
337
+ /* Sets the thread's local storage pointer. */
338
+ static inline int
339
+ __gthread_objc_thread_set_data (void *value)
340
+ {
341
+ if (__gthread_active_p ())
342
+ return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
343
+ else
344
+ {
345
+ thread_local_storage = value;
346
+ return 0;
347
+ }
348
+ }
349
+
350
+ /* Returns the thread's local storage pointer. */
351
+ static inline void *
352
+ __gthread_objc_thread_get_data (void)
353
+ {
354
+ if (__gthread_active_p ())
355
+ return __gthrw_(pthread_getspecific) (_objc_thread_storage);
356
+ else
357
+ return thread_local_storage;
358
+ }
359
+
360
+ /* Backend mutex functions */
361
+
362
+ /* Allocate a mutex. */
363
+ static inline int
364
+ __gthread_objc_mutex_allocate (objc_mutex_t mutex)
365
+ {
366
+ if (__gthread_active_p ())
367
+ {
368
+ mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
369
+
370
+ if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
371
+ {
372
+ objc_free (mutex->backend);
373
+ mutex->backend = NULL;
374
+ return -1;
375
+ }
376
+ }
377
+
378
+ return 0;
379
+ }
380
+
381
+ /* Deallocate a mutex. */
382
+ static inline int
383
+ __gthread_objc_mutex_deallocate (objc_mutex_t mutex)
384
+ {
385
+ if (__gthread_active_p ())
386
+ {
387
+ int count;
388
+
389
+ /*
390
+ * Posix Threads specifically require that the thread be unlocked
391
+ * for __gthrw_(pthread_mutex_destroy) to work.
392
+ */
393
+
394
+ do
395
+ {
396
+ count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
397
+ if (count < 0)
398
+ return -1;
399
+ }
400
+ while (count);
401
+
402
+ if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
403
+ return -1;
404
+
405
+ objc_free (mutex->backend);
406
+ mutex->backend = NULL;
407
+ }
408
+ return 0;
409
+ }
410
+
411
+ /* Grab a lock on a mutex. */
412
+ static inline int
413
+ __gthread_objc_mutex_lock (objc_mutex_t mutex)
414
+ {
415
+ if (__gthread_active_p ()
416
+ && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
417
+ {
418
+ return -1;
419
+ }
420
+
421
+ return 0;
422
+ }
423
+
424
+ /* Try to grab a lock on a mutex. */
425
+ static inline int
426
+ __gthread_objc_mutex_trylock (objc_mutex_t mutex)
427
+ {
428
+ if (__gthread_active_p ()
429
+ && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
430
+ {
431
+ return -1;
432
+ }
433
+
434
+ return 0;
435
+ }
436
+
437
+ /* Unlock the mutex */
438
+ static inline int
439
+ __gthread_objc_mutex_unlock (objc_mutex_t mutex)
440
+ {
441
+ if (__gthread_active_p ()
442
+ && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
443
+ {
444
+ return -1;
445
+ }
446
+
447
+ return 0;
448
+ }
449
+
450
+ /* Backend condition mutex functions */
451
+
452
+ /* Allocate a condition. */
453
+ static inline int
454
+ __gthread_objc_condition_allocate (objc_condition_t condition)
455
+ {
456
+ if (__gthread_active_p ())
457
+ {
458
+ condition->backend = objc_malloc (sizeof (pthread_cond_t));
459
+
460
+ if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
461
+ {
462
+ objc_free (condition->backend);
463
+ condition->backend = NULL;
464
+ return -1;
465
+ }
466
+ }
467
+
468
+ return 0;
469
+ }
470
+
471
+ /* Deallocate a condition. */
472
+ static inline int
473
+ __gthread_objc_condition_deallocate (objc_condition_t condition)
474
+ {
475
+ if (__gthread_active_p ())
476
+ {
477
+ if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
478
+ return -1;
479
+
480
+ objc_free (condition->backend);
481
+ condition->backend = NULL;
482
+ }
483
+ return 0;
484
+ }
485
+
486
+ /* Wait on the condition */
487
+ static inline int
488
+ __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
489
+ {
490
+ if (__gthread_active_p ())
491
+ return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
492
+ (pthread_mutex_t *) mutex->backend);
493
+ else
494
+ return 0;
495
+ }
496
+
497
+ /* Wake up all threads waiting on this condition. */
498
+ static inline int
499
+ __gthread_objc_condition_broadcast (objc_condition_t condition)
500
+ {
501
+ if (__gthread_active_p ())
502
+ return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
503
+ else
504
+ return 0;
505
+ }
506
+
507
+ /* Wake up one thread waiting on this condition. */
508
+ static inline int
509
+ __gthread_objc_condition_signal (objc_condition_t condition)
510
+ {
511
+ if (__gthread_active_p ())
512
+ return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
513
+ else
514
+ return 0;
515
+ }
516
+
517
+ #else /* _LIBOBJC */
518
+
519
+ static inline int
520
+ __gthread_once (__gthread_once_t *once, void (*func) (void))
521
+ {
522
+ if (__gthread_active_p ())
523
+ return __gthrw_(pthread_once) (once, func);
524
+ else
525
+ return -1;
526
+ }
527
+
528
+ static inline int
529
+ __gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
530
+ {
531
+ return __gthrw_(pthread_key_create) (key, dtor);
532
+ }
533
+
534
+ static inline int
535
+ __gthread_key_delete (__gthread_key_t key)
536
+ {
537
+ return __gthrw_(pthread_key_delete) (key);
538
+ }
539
+
540
+ static inline void *
541
+ __gthread_getspecific (__gthread_key_t key)
542
+ {
543
+ return __gthrw_(pthread_getspecific) (key);
544
+ }
545
+
546
+ static inline int
547
+ __gthread_setspecific (__gthread_key_t key, const void *ptr)
548
+ {
549
+ return __gthrw_(pthread_setspecific) (key, ptr);
550
+ }
551
+
552
+ static inline int
553
+ __gthread_mutex_lock (__gthread_mutex_t *mutex)
554
+ {
555
+ if (__gthread_active_p ())
556
+ return __gthrw_(pthread_mutex_lock) (mutex);
557
+ else
558
+ return 0;
559
+ }
560
+
561
+ static inline int
562
+ __gthread_mutex_trylock (__gthread_mutex_t *mutex)
563
+ {
564
+ if (__gthread_active_p ())
565
+ return __gthrw_(pthread_mutex_trylock) (mutex);
566
+ else
567
+ return 0;
568
+ }
569
+
570
+ static inline int
571
+ __gthread_mutex_unlock (__gthread_mutex_t *mutex)
572
+ {
573
+ if (__gthread_active_p ())
574
+ return __gthrw_(pthread_mutex_unlock) (mutex);
575
+ else
576
+ return 0;
577
+ }
578
+
579
+ #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
580
+ static inline int
581
+ __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
582
+ {
583
+ if (__gthread_active_p ())
584
+ {
585
+ pthread_mutexattr_t attr;
586
+ int r;
587
+
588
+ r = __gthrw_(pthread_mutexattr_init) (&attr);
589
+ if (!r)
590
+ r = __gthrw_(pthread_mutexattr_settype) (&attr, PTHREAD_MUTEX_RECURSIVE);
591
+ if (!r)
592
+ r = __gthrw_(pthread_mutex_init) (mutex, &attr);
593
+ if (!r)
594
+ r = __gthrw_(pthread_mutexattr_destroy) (&attr);
595
+ return r;
596
+ }
597
+ return 0;
598
+ }
599
+ #endif
600
+
601
+ static inline int
602
+ __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
603
+ {
604
+ return __gthread_mutex_lock (mutex);
605
+ }
606
+
607
+ static inline int
608
+ __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
609
+ {
610
+ return __gthread_mutex_trylock (mutex);
611
+ }
612
+
613
+ static inline int
614
+ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
615
+ {
616
+ return __gthread_mutex_unlock (mutex);
617
+ }
618
+
619
+ #endif /* _LIBOBJC */
620
+
621
+ #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
622
+ #endif