|
1 | 1 | #include "thread.h" |
2 | 2 |
|
3 | | -<<<<<<< thread.c |
4 | | -#ifndef DEBUG |
5 | | -#define DEBUG |
6 | | -#endif |
7 | | - |
8 | 3 | #ifdef DEBUG |
9 | 4 | #define dprintf(args) printf args |
10 | 5 | #else |
11 | 6 | #define dprintf(args) |
12 | 7 | #endif |
13 | 8 |
|
14 | | -======= |
15 | | -#ifdef DEBUG |
16 | | -#define dprintf(args) printf args |
17 | | -#else |
18 | | -#define dprintf(args) |
19 | | -#endif |
20 | | - |
21 | | ->>>>>>> 2.3 |
22 | 9 | #ifdef __sgi |
23 | 10 | #include <stdlib.h> |
24 | 11 | #include <stdio.h> |
@@ -72,7 +59,6 @@ struct lock { |
72 | 59 |
|
73 | 60 | static int initialized; |
74 | 61 |
|
75 | | -<<<<<<< thread.c |
76 | 62 | #ifdef __sgi |
77 | 63 | /* |
78 | 64 | * This routine is called as a signal handler when another thread |
@@ -148,83 +134,6 @@ void init_thread _P0() |
148 | 134 | /* |
149 | 135 | * Thread support. |
150 | 136 | */ |
151 | | -======= |
152 | | -#ifdef __sgi |
153 | | -/* |
154 | | - * This routine is called as a signal handler when another thread |
155 | | - * exits. When that happens, we must see whether we have to exit as |
156 | | - * well (because of an exit_prog()) or whether we should continue on. |
157 | | - */ |
158 | | -static void exit_sig _P0() |
159 | | -{ |
160 | | - dprintf(("exit_sig called\n")); |
161 | | - if (exiting && getpid() == my_pid) { |
162 | | - dprintf(("already exiting\n")); |
163 | | - return; |
164 | | - } |
165 | | - if (do_exit) { |
166 | | - dprintf(("exiting in exit_sig\n")); |
167 | | - exit_thread(); |
168 | | - } |
169 | | -} |
170 | | - |
171 | | -/* |
172 | | - * This routune is called when a process calls exit(). If that wasn't |
173 | | - * done from the library, we do as if an exit_prog() was intended. |
174 | | - */ |
175 | | -static void maybe_exit _P0() |
176 | | -{ |
177 | | - dprintf(("maybe_exit called\n")); |
178 | | - if (exiting) { |
179 | | - dprintf(("already exiting\n")); |
180 | | - return; |
181 | | - } |
182 | | - exit_prog(0); |
183 | | -} |
184 | | -#endif |
185 | | - |
186 | | -/* |
187 | | - * Initialization. |
188 | | - */ |
189 | | -void init_thread _P0() |
190 | | -{ |
191 | | -#ifdef __sgi |
192 | | - struct sigaction s; |
193 | | -#endif |
194 | | - |
195 | | - dprintf(("init_thread called\n")); |
196 | | - if (initialized) |
197 | | - return; |
198 | | - initialized = 1; |
199 | | - |
200 | | -#ifdef __sgi |
201 | | - my_pid = getpid(); /* so that we know which is the main thread */ |
202 | | - atexit(maybe_exit); |
203 | | - s.sa_handler = exit_sig; |
204 | | - sigemptyset(&s.sa_mask); |
205 | | - sigaddset(&s.sa_mask, SIGUSR1); |
206 | | - s.sa_flags = 0; |
207 | | - sigaction(SIGUSR1, &s, 0); |
208 | | - prctl(PR_SETEXITSIG, SIGUSR1); |
209 | | - usconfig(CONF_ARENATYPE, US_SHAREDONLY); |
210 | | - /*usconfig(CONF_LOCKTYPE, US_DEBUGPLUS);*/ |
211 | | - shared_arena = usinit(tmpnam(0)); |
212 | | - count_lock = usnewlock(shared_arena); |
213 | | - (void) usinitlock(count_lock); |
214 | | - wait_lock = usnewlock(shared_arena); |
215 | | -#endif |
216 | | -#ifdef sun |
217 | | - lwp_setstkcache(STACKSIZE, NSTACKS); |
218 | | -#endif |
219 | | -#ifdef C_THREADS |
220 | | - cthread_init(); |
221 | | -#endif |
222 | | -} |
223 | | - |
224 | | -/* |
225 | | - * Thread support. |
226 | | - */ |
227 | | ->>>>>>> 2.3 |
228 | 137 | int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) |
229 | 138 | { |
230 | 139 | #ifdef sun |
|
0 commit comments