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
02cb0eb2
Kaydet (Commit)
02cb0eb2
authored
Nis 01, 2009
tarafından
Jesse Noller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix multiprocessing.event to match the new threading.Event API
üst
a83da350
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
multiprocessing.rst
Doc/library/multiprocessing.rst
+6
-0
synchronize.py
Lib/multiprocessing/synchronize.py
+5
-0
test_multiprocessing.py
Lib/test/test_multiprocessing.py
+9
-7
No files found.
Doc/library/multiprocessing.rst
Dosyayı görüntüle @
02cb0eb2
...
...
@@ -836,6 +836,12 @@ object -- see :ref:`multiprocessing-managers`.
..
class
::
Event
()
A
clone
of
:
class
:`
threading
.
Event
`.
This
method
returns
the
state
of
the
internal
semaphore
on
exit
,
so
it
will
always
return
``
True
``
except
if
a
timeout
is
given
and
the
operation
times
out
.
..
versionchanged
::
2.7
Previously
,
the
method
always
returned
``
None
``.
..
class
::
Lock
()
...
...
Lib/multiprocessing/synchronize.py
Dosyayı görüntüle @
02cb0eb2
...
...
@@ -301,5 +301,10 @@ class Event(object):
self
.
_flag
.
release
()
else
:
self
.
_cond
.
wait
(
timeout
)
if
self
.
_flag
.
acquire
(
False
):
self
.
_flag
.
release
()
return
True
return
False
finally
:
self
.
_cond
.
release
()
Lib/test/test_multiprocessing.py
Dosyayı görüntüle @
02cb0eb2
...
...
@@ -749,20 +749,22 @@ class _TestEvent(BaseTestCase):
# Removed temporaily, due to API shear, this does not
# work with threading._Event objects. is_set == isSet
#
self.assertEqual(event.is_set(), False)
self
.
assertEqual
(
event
.
is_set
(),
False
)
self
.
assertEqual
(
wait
(
0.0
),
None
)
# Removed, threading.Event.wait() will return the value of the __flag
# instead of None. API Shear with the semaphore backed mp.Event
self
.
assertEqual
(
wait
(
0.0
),
False
)
self
.
assertTimingAlmostEqual
(
wait
.
elapsed
,
0.0
)
self
.
assertEqual
(
wait
(
TIMEOUT1
),
Non
e
)
self
.
assertEqual
(
wait
(
TIMEOUT1
),
Fals
e
)
self
.
assertTimingAlmostEqual
(
wait
.
elapsed
,
TIMEOUT1
)
event
.
set
()
# See note above on the API differences
#
self.assertEqual(event.is_set(), True)
self
.
assertEqual
(
wait
(),
Non
e
)
self
.
assertEqual
(
event
.
is_set
(),
True
)
self
.
assertEqual
(
wait
(),
Tru
e
)
self
.
assertTimingAlmostEqual
(
wait
.
elapsed
,
0.0
)
self
.
assertEqual
(
wait
(
TIMEOUT1
),
Non
e
)
self
.
assertEqual
(
wait
(
TIMEOUT1
),
Tru
e
)
self
.
assertTimingAlmostEqual
(
wait
.
elapsed
,
0.0
)
# self.assertEqual(event.is_set(), True)
...
...
@@ -771,7 +773,7 @@ class _TestEvent(BaseTestCase):
#self.assertEqual(event.is_set(), False)
self
.
Process
(
target
=
self
.
_test_event
,
args
=
(
event
,))
.
start
()
self
.
assertEqual
(
wait
(),
Non
e
)
self
.
assertEqual
(
wait
(),
Tru
e
)
#
#
...
...
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