Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aee8bc1

Browse files
adapted SV module to the new svideo library.
update thread package.
1 parent e0be2b3 commit aee8bc1

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

Python/thread.c

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
#include "thread.h"
22

3+
<<<<<<< thread.c
4+
#ifndef DEBUG
5+
#define DEBUG
6+
#endif
7+
38
#ifdef DEBUG
49
#define dprintf(args) printf args
510
#else
611
#define dprintf(args)
712
#endif
813

14+
=======
15+
#ifdef DEBUG
16+
#define dprintf(args) printf args
17+
#else
18+
#define dprintf(args)
19+
#endif
20+
21+
>>>>>>> 2.3
922
#ifdef __sgi
1023
#include <stdlib.h>
1124
#include <stdio.h>
@@ -59,6 +72,83 @@ struct lock {
5972

6073
static int initialized;
6174

75+
<<<<<<< thread.c
76+
#ifdef __sgi
77+
/*
78+
* This routine is called as a signal handler when another thread
79+
* exits. When that happens, we must see whether we have to exit as
80+
* well (because of an exit_prog()) or whether we should continue on.
81+
*/
82+
static void exit_sig _P0()
83+
{
84+
dprintf(("exit_sig called\n"));
85+
if (exiting && getpid() == my_pid) {
86+
dprintf(("already exiting\n"));
87+
return;
88+
}
89+
if (do_exit) {
90+
dprintf(("exiting in exit_sig\n"));
91+
exit_thread();
92+
}
93+
}
94+
95+
/*
96+
* This routine is called when a process calls exit(). If that wasn't
97+
* done from the library, we do as if an exit_prog() was intended.
98+
*/
99+
static void maybe_exit _P0()
100+
{
101+
dprintf(("maybe_exit called\n"));
102+
if (exiting) {
103+
dprintf(("already exiting\n"));
104+
return;
105+
}
106+
exit_prog(0);
107+
}
108+
#endif
109+
110+
/*
111+
* Initialization.
112+
*/
113+
void init_thread _P0()
114+
{
115+
#ifdef __sgi
116+
struct sigaction s;
117+
#endif
118+
119+
dprintf(("init_thread called\n"));
120+
if (initialized)
121+
return;
122+
initialized = 1;
123+
124+
#ifdef __sgi
125+
my_pid = getpid(); /* so that we know which is the main thread */
126+
atexit(maybe_exit);
127+
s.sa_handler = exit_sig;
128+
sigemptyset(&s.sa_mask);
129+
sigaddset(&s.sa_mask, SIGUSR1);
130+
s.sa_flags = 0;
131+
sigaction(SIGUSR1, &s, 0);
132+
prctl(PR_SETEXITSIG, SIGUSR1);
133+
usconfig(CONF_ARENATYPE, US_SHAREDONLY);
134+
/*usconfig(CONF_LOCKTYPE, US_DEBUGPLUS);*/
135+
shared_arena = usinit(tmpnam(0));
136+
count_lock = usnewlock(shared_arena);
137+
(void) usinitlock(count_lock);
138+
wait_lock = usnewlock(shared_arena);
139+
#endif
140+
#ifdef sun
141+
lwp_setstkcache(STACKSIZE, NSTACKS);
142+
#endif
143+
#ifdef C_THREADS
144+
cthread_init();
145+
#endif
146+
}
147+
148+
/*
149+
* Thread support.
150+
*/
151+
=======
62152
#ifdef __sgi
63153
/*
64154
* This routine is called as a signal handler when another thread
@@ -134,6 +224,7 @@ void init_thread _P0()
134224
/*
135225
* Thread support.
136226
*/
227+
>>>>>>> 2.3
137228
int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
138229
{
139230
#ifdef sun

0 commit comments

Comments
 (0)