Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6f5f8dde
Kaydet (Commit)
6f5f8dde
authored
May 30, 1994
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix waiting for children -- save ppid in pidlist as well.
üst
3962fdb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
14 deletions
+34
-14
thread_sgi.h
Python/thread_sgi.h
+34
-14
No files found.
Python/thread_sgi.h
Dosyayı görüntüle @
6f5f8dde
...
...
@@ -49,7 +49,10 @@ static int do_exit; /* indicates that the program is to exit */
#endif
static
int
exiting
;
/* we're already exiting (for maybe_exit) */
static
pid_t
my_pid
;
/* PID of main thread */
static
pid_t
pidlist
[
MAXPROC
];
/* PIDs of other threads */
static
struct
pidlist
{
pid_t
parent
;
pid_t
child
;
}
pidlist
[
MAXPROC
];
/* PIDs of other threads; protected by count_lock */
static
int
maxpidindex
;
/* # of PIDs in pidlist */
#ifndef NO_EXIT_PROG
...
...
@@ -156,24 +159,36 @@ static void _init_thread _P0()
static
void
clean_threads
_P0
()
{
int
i
;
pid_t
pid
;
int
i
,
j
;
pid_t
mypid
,
pid
;
/* clean up any exited threads */
mypid
=
getpid
();
i
=
0
;
while
(
i
<
maxpidindex
)
{
if
(
(
pid
=
pidlist
[
i
]
)
>
0
)
{
if
(
pidlist
[
i
].
parent
==
mypid
&&
(
pid
=
pidlist
[
i
].
child
)
>
0
)
{
pid
=
waitpid
(
pid
,
0
,
WNOHANG
);
if
(
pid
<
0
)
return
;
if
(
pid
!=
0
)
{
if
(
pid
>
0
)
{
/* a thread has exited */
pidlist
[
i
]
=
pidlist
[
--
maxpidindex
];
/* remove references to children of dead proc */
for
(
j
=
0
;
j
<
maxpidindex
;
j
++
)
if
(
pidlist
[
j
].
parent
==
pid
)
pidlist
[
j
].
child
=
-
1
;
continue
;
/* don't increment i */
}
}
i
++
;
}
/* clean up the list */
i
=
0
;
while
(
i
<
maxpidindex
)
{
if
(
pidlist
[
i
].
child
==
-
1
)
{
pidlist
[
i
]
=
pidlist
[
--
maxpidindex
];
continue
;
/* don't increment i */
}
i
++
;
}
}
int
start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
...
...
@@ -202,9 +217,11 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
if
(
usconfig
(
CONF_INITSIZE
,
size
)
<
0
)
perror
(
"usconfig - CONF_INITSIZE (reset)"
);
addr
=
(
long
)
dl_getrange
(
size
+
HDR_SIZE
);
dprintf
((
"trying to use addr %lx-%lx for sproc
\n
"
,
addr
,
addr
+
size
));
dprintf
((
"trying to use addr %lx-%lx for sproc
\n
"
,
addr
,
addr
+
size
));
errno
=
0
;
if
((
addr
=
usconfig
(
CONF_ATTACHADDR
,
addr
))
<
0
&&
errno
!=
0
)
if
((
addr
=
usconfig
(
CONF_ATTACHADDR
,
addr
))
<
0
&&
errno
!=
0
)
perror
(
"usconfig - CONF_ATTACHADDR (set)"
);
}
#endif
/* USE_DL */
...
...
@@ -213,15 +230,18 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
perror
(
"sproc"
);
#ifdef USE_DL
if
(
!
local_initialized
)
{
if
(
usconfig
(
CONF_ATTACHADDR
,
addr
)
<
0
)
/* reset address */
if
(
usconfig
(
CONF_ATTACHADDR
,
addr
)
<
0
)
/* reset address */
perror
(
"usconfig - CONF_ATTACHADDR (reset)"
);
local_initialized
=
1
;
}
#endif
/* USE_DL */
if
(
success
>=
0
)
{
nthreads
++
;
pidlist
[
maxpidindex
++
]
=
success
;
dprintf
((
"pidlist[%d] = %d
\n
"
,
maxpidindex
-
1
,
success
));
pidlist
[
maxpidindex
].
parent
=
getpid
();
pidlist
[
maxpidindex
++
].
child
=
success
;
dprintf
((
"pidlist[%d] = %d
\n
"
,
maxpidindex
-
1
,
success
));
}
}
if
(
usunsetlock
(
count_lock
)
<
0
)
...
...
@@ -257,8 +277,8 @@ static void do_exit_thread _P1(no_cleanup, int no_cleanup)
if
(
nthreads
>=
0
)
{
dprintf
((
"kill other threads
\n
"
));
for
(
i
=
0
;
i
<
maxpidindex
;
i
++
)
if
(
pidlist
[
i
]
>
0
)
(
void
)
kill
(
pidlist
[
i
],
if
(
pidlist
[
i
]
.
child
>
0
)
(
void
)
kill
(
pidlist
[
i
]
.
child
,
SIGKILL
);
_exit
(
exit_status
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment