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
59fb38b5
Kaydet (Commit)
59fb38b5
authored
Eyl 09, 2012
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #15881: Fixed atexit hook in multiprocessing.
üst
47bcfff2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
16 deletions
+39
-16
ACKS.txt
Doc/ACKS.txt
+1
-0
util.py
Lib/multiprocessing/util.py
+38
-16
No files found.
Doc/ACKS.txt
Dosyayı görüntüle @
59fb38b5
...
@@ -236,3 +236,4 @@ docs@python.org), and we'll be glad to correct the problem.
...
@@ -236,3 +236,4 @@ docs@python.org), and we'll be glad to correct the problem.
* Moshe Zadka
* Moshe Zadka
* Milan Zamazal
* Milan Zamazal
* Cheng Zhang
* Cheng Zhang
* Chris McDonough
Lib/multiprocessing/util.py
Dosyayı görüntüle @
59fb38b5
...
@@ -247,6 +247,12 @@ def _run_finalizers(minpriority=None):
...
@@ -247,6 +247,12 @@ def _run_finalizers(minpriority=None):
Finalizers with highest priority are called first; finalizers with
Finalizers with highest priority are called first; finalizers with
the same priority will be called in reverse order of creation.
the same priority will be called in reverse order of creation.
'''
'''
if
_finalizer_registry
is
None
:
# This function may be called after this module's globals are
# destroyed. See the _exit_function function in this module for more
# notes.
return
if
minpriority
is
None
:
if
minpriority
is
None
:
f
=
lambda
p
:
p
[
0
][
0
]
is
not
None
f
=
lambda
p
:
p
[
0
][
0
]
is
not
None
else
:
else
:
...
@@ -278,24 +284,40 @@ def is_exiting():
...
@@ -278,24 +284,40 @@ def is_exiting():
_exiting
=
False
_exiting
=
False
def
_exit_function
(
):
def
_exit_function
(
info
=
info
,
debug
=
debug
,
_run_finalizers
=
_run_finalizers
,
global
_exiting
active_children
=
active_children
,
current_process
=
current_process
):
info
(
'process shutting down'
)
# We hold on to references to functions in the arglist due to the
debug
(
'running all "atexit" finalizers with priority >= 0'
)
# situation described below, where this function is called after this
_run_finalizers
(
0
)
# module's globals are destroyed.
for
p
in
active_children
():
global
_exiting
if
p
.
_daemonic
:
info
(
'calling terminate() for daemon
%
s'
,
p
.
name
)
p
.
_popen
.
terminate
()
for
p
in
active_children
():
info
(
'calling join() for process
%
s'
,
p
.
name
)
p
.
join
()
debug
(
'running the remaining "atexit" finalizers'
)
if
not
_exiting
:
_run_finalizers
()
info
(
'process shutting down'
)
debug
(
'running all "atexit" finalizers with priority >= 0'
)
_run_finalizers
(
0
)
if
current_process
()
is
not
None
:
# We check if the current process is None here because if
# it's None, any call to ``active_children()`` will throw an
# AttributeError (active_children winds up trying to get
# attributes from util._current_process). This happens in a
# variety of shutdown circumstances that are not well-understood
# because module-scope variables are not apparently supposed to
# be destroyed until after this function is called. However,
# they are indeed destroyed before this function is called. See
# issues #9775 and #15881. Also related: #4106, #9205, and #9207.
for
p
in
active_children
():
if
p
.
_daemonic
:
info
(
'calling terminate() for daemon
%
s'
,
p
.
name
)
p
.
_popen
.
terminate
()
for
p
in
active_children
():
info
(
'calling join() for process
%
s'
,
p
.
name
)
p
.
join
()
debug
(
'running the remaining "atexit" finalizers'
)
_run_finalizers
()
atexit
.
register
(
_exit_function
)
atexit
.
register
(
_exit_function
)
...
...
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