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