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
ec4b174d
Kaydet (Commit)
ec4b174d
authored
Mar 11, 2013
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17385: Fix quadratic behavior in threading.Condition
üst
720da571
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
threading.py
Lib/threading.py
+8
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/threading.py
Dosyayı görüntüle @
ec4b174d
...
@@ -10,6 +10,12 @@ except ImportError:
...
@@ -10,6 +10,12 @@ except ImportError:
from
time
import
time
as
_time
from
time
import
time
as
_time
from
traceback
import
format_exc
as
_format_exc
from
traceback
import
format_exc
as
_format_exc
from
_weakrefset
import
WeakSet
from
_weakrefset
import
WeakSet
try
:
from
_itertools
import
islice
as
_slice
from
_collections
import
deque
as
_deque
except
ImportError
:
from
itertools
import
islice
as
_islice
from
collections
import
deque
as
_deque
# Note regarding PEP 8 compliant names
# Note regarding PEP 8 compliant names
# This threading model was originally inspired by Java, and inherited
# This threading model was originally inspired by Java, and inherited
...
@@ -146,7 +152,7 @@ class Condition:
...
@@ -146,7 +152,7 @@ class Condition:
self
.
_is_owned
=
lock
.
_is_owned
self
.
_is_owned
=
lock
.
_is_owned
except
AttributeError
:
except
AttributeError
:
pass
pass
self
.
_waiters
=
[]
self
.
_waiters
=
_deque
()
def
__enter__
(
self
):
def
__enter__
(
self
):
return
self
.
_lock
.
__enter__
()
return
self
.
_lock
.
__enter__
()
...
@@ -217,7 +223,7 @@ class Condition:
...
@@ -217,7 +223,7 @@ class Condition:
if
not
self
.
_is_owned
():
if
not
self
.
_is_owned
():
raise
RuntimeError
(
"cannot notify on un-acquired lock"
)
raise
RuntimeError
(
"cannot notify on un-acquired lock"
)
__waiters
=
self
.
_waiters
__waiters
=
self
.
_waiters
waiters
=
_
_waiters
[:
n
]
waiters
=
_
deque
(
_islice
(
__waiters
,
n
))
if
not
waiters
:
if
not
waiters
:
return
return
for
waiter
in
waiters
:
for
waiter
in
waiters
:
...
...
Misc/NEWS
Dosyayı görüntüle @
ec4b174d
...
@@ -277,6 +277,9 @@ Core and Builtins
...
@@ -277,6 +277,9 @@ Core and Builtins
Library
Library
-------
-------
_
Issue
#
17385
:
Fix
quadratic
behavior
in
threading
.
Condition
.
The
FIFO
queue
now
uses
a
deque
instead
of
a
list
.
-
Issue
#
14645
:
The
email
generator
classes
now
produce
output
using
the
-
Issue
#
14645
:
The
email
generator
classes
now
produce
output
using
the
specified
linesep
throughout
.
Previously
if
the
prolog
,
epilog
,
or
specified
linesep
throughout
.
Previously
if
the
prolog
,
epilog
,
or
body
were
stored
with
a
different
linesep
,
that
linesep
was
used
.
This
body
were
stored
with
a
different
linesep
,
that
linesep
was
used
.
This
...
...
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