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
bd7b5dd8
Kaydet (Commit)
bd7b5dd8
authored
Haz 04, 2012
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Prevent handle leak if CreateProcess() fails in multiprocessing
üst
86eb7e97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
25 deletions
+27
-25
forking.py
Lib/multiprocessing/forking.py
+27
-25
No files found.
Lib/multiprocessing/forking.py
Dosyayı görüntüle @
bd7b5dd8
...
...
@@ -209,6 +209,9 @@ else:
_tls
=
_thread
.
_local
()
def
__init__
(
self
,
process_obj
):
cmd
=
' '
.
join
(
'"
%
s"'
%
x
for
x
in
get_command_line
())
prep_data
=
get_preparation_data
(
process_obj
.
_name
)
# create pipe for communication with child
rfd
,
wfd
=
os
.
pipe
()
...
...
@@ -216,31 +219,30 @@ else:
rhandle
=
duplicate
(
msvcrt
.
get_osfhandle
(
rfd
),
inheritable
=
True
)
os
.
close
(
rfd
)
# start process
cmd
=
get_command_line
()
+
[
rhandle
]
cmd
=
' '
.
join
(
'"
%
s"'
%
x
for
x
in
cmd
)
hp
,
ht
,
pid
,
tid
=
_winapi
.
CreateProcess
(
_python_exe
,
cmd
,
None
,
None
,
1
,
0
,
None
,
None
,
None
)
_winapi
.
CloseHandle
(
ht
)
close
(
rhandle
)
# set attributes of self
self
.
pid
=
pid
self
.
returncode
=
None
self
.
_handle
=
hp
self
.
sentinel
=
int
(
hp
)
# send information to child
prep_data
=
get_preparation_data
(
process_obj
.
_name
)
to_child
=
os
.
fdopen
(
wfd
,
'wb'
)
Popen
.
_tls
.
process_handle
=
int
(
hp
)
try
:
dump
(
prep_data
,
to_child
,
HIGHEST_PROTOCOL
)
dump
(
process_obj
,
to_child
,
HIGHEST_PROTOCOL
)
finally
:
del
Popen
.
_tls
.
process_handle
to_child
.
close
()
with
open
(
wfd
,
'wb'
,
closefd
=
True
)
as
to_child
:
# start process
try
:
hp
,
ht
,
pid
,
tid
=
_winapi
.
CreateProcess
(
_python_exe
,
cmd
+
(
'
%
s'
%
rhandle
),
None
,
None
,
1
,
0
,
None
,
None
,
None
)
_winapi
.
CloseHandle
(
ht
)
finally
:
close
(
rhandle
)
# set attributes of self
self
.
pid
=
pid
self
.
returncode
=
None
self
.
_handle
=
hp
self
.
sentinel
=
int
(
hp
)
# send information to child
Popen
.
_tls
.
process_handle
=
int
(
hp
)
try
:
dump
(
prep_data
,
to_child
,
HIGHEST_PROTOCOL
)
dump
(
process_obj
,
to_child
,
HIGHEST_PROTOCOL
)
finally
:
del
Popen
.
_tls
.
process_handle
@staticmethod
def
thread_is_spawning
():
...
...
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