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
b4f39e85
Kaydet (Commit)
b4f39e85
authored
Ara 31, 2012
tarafından
Giampaolo Rodola'
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Fix issue 10527: make multiprocessing use poll() instead of select() if available.
üst
8d518970
5051ca88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
connection.py
Lib/multiprocessing/connection.py
+21
-0
test_multiprocessing.py
Lib/test/test_multiprocessing.py
+4
-2
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/multiprocessing/connection.py
Dosyayı görüntüle @
b4f39e85
...
...
@@ -509,6 +509,27 @@ if sys.platform != 'win32':
return
c1
,
c2
else
:
if
hasattr
(
select
,
'poll'
):
def
_poll
(
fds
,
timeout
):
if
timeout
is
not
None
:
timeout
=
int
(
timeout
)
*
1000
# timeout is in milliseconds
fd_map
=
{}
pollster
=
select
.
poll
()
for
fd
in
fds
:
pollster
.
register
(
fd
,
select
.
POLLIN
)
if
hasattr
(
fd
,
'fileno'
):
fd_map
[
fd
.
fileno
()]
=
fd
else
:
fd_map
[
fd
]
=
fd
ls
=
[]
for
fd
,
event
in
pollster
.
poll
(
timeout
):
if
event
&
select
.
POLLNVAL
:
raise
ValueError
(
'invalid file descriptor
%
i'
%
fd
)
ls
.
append
(
fd_map
[
fd
])
return
ls
else
:
def
_poll
(
fds
,
timeout
):
return
select
.
select
(
fds
,
[],
[],
timeout
)[
0
]
def
Pipe
(
duplex
=
True
):
'''
...
...
Lib/test/test_multiprocessing.py
Dosyayı görüntüle @
b4f39e85
...
...
@@ -2102,6 +2102,7 @@ class _TestConnection(BaseTestCase):
self
.
assertTimingAlmostEqual
(
poll
.
elapsed
,
TIMEOUT1
)
conn
.
send
(
None
)
time
.
sleep
(
.
1
)
self
.
assertEqual
(
poll
(
TIMEOUT1
),
True
)
self
.
assertTimingAlmostEqual
(
poll
.
elapsed
,
0
)
...
...
@@ -3251,6 +3252,7 @@ class TestWait(unittest.TestCase):
from
multiprocessing.connection
import
wait
expected
=
3
sorted_
=
lambda
l
:
sorted
(
l
,
key
=
lambda
x
:
isinstance
(
x
,
int
))
sem
=
multiprocessing
.
Semaphore
(
0
)
a
,
b
=
multiprocessing
.
Pipe
()
p
=
multiprocessing
.
Process
(
target
=
self
.
signal_and_sleep
,
...
...
@@ -3274,7 +3276,7 @@ class TestWait(unittest.TestCase):
res
=
wait
([
a
,
p
.
sentinel
,
b
],
20
)
delta
=
time
.
time
()
-
start
self
.
assertEqual
(
res
,
[
p
.
sentinel
,
b
]
)
self
.
assertEqual
(
sorted_
(
res
),
sorted_
([
p
.
sentinel
,
b
])
)
self
.
assertLess
(
delta
,
0.4
)
b
.
send
(
None
)
...
...
@@ -3283,7 +3285,7 @@ class TestWait(unittest.TestCase):
res
=
wait
([
a
,
p
.
sentinel
,
b
],
20
)
delta
=
time
.
time
()
-
start
self
.
assertEqual
(
res
,
[
a
,
p
.
sentinel
,
b
]
)
self
.
assertEqual
(
sorted_
(
res
),
sorted_
([
a
,
p
.
sentinel
,
b
])
)
self
.
assertLess
(
delta
,
0.4
)
p
.
terminate
()
...
...
Misc/NEWS
Dosyayı görüntüle @
b4f39e85
...
...
@@ -200,6 +200,8 @@ Core and Builtins
Library
-------
-
Issue
10527
:
make
multiprocessing
use
poll
()
instead
of
select
()
if
available
.
-
Issue
#
16688
:
Fix
backreferences
did
make
case
-
insensitive
regex
fail
on
non
-
ASCII
strings
.
Patch
by
Matthew
Barnett
.
...
...
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