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
d07db96a
Kaydet (Commit)
d07db96a
authored
Ara 29, 2012
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16640: Run less code under a lock in sched module.
üst
1147f824
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
sched.py
Lib/sched.py
+5
-6
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/sched.py
Dosyayı görüntüle @
d07db96a
...
...
@@ -71,10 +71,10 @@ class scheduler:
"""
if
kwargs
is
_sentinel
:
kwargs
=
{}
event
=
Event
(
time
,
priority
,
action
,
argument
,
kwargs
)
with
self
.
_lock
:
event
=
Event
(
time
,
priority
,
action
,
argument
,
kwargs
)
heapq
.
heappush
(
self
.
_queue
,
event
)
return
event
# The ID
return
event
# The ID
def
enter
(
self
,
delay
,
priority
,
action
,
argument
=
(),
kwargs
=
_sentinel
):
"""A variant that specifies the time as a relative time.
...
...
@@ -82,9 +82,8 @@ class scheduler:
This is actually the more commonly used interface.
"""
with
self
.
_lock
:
time
=
self
.
timefunc
()
+
delay
return
self
.
enterabs
(
time
,
priority
,
action
,
argument
,
kwargs
)
time
=
self
.
timefunc
()
+
delay
return
self
.
enterabs
(
time
,
priority
,
action
,
argument
,
kwargs
)
def
cancel
(
self
,
event
):
"""Remove an event from the queue.
...
...
@@ -165,4 +164,4 @@ class scheduler:
# the actual order they would be retrieved.
with
self
.
_lock
:
events
=
self
.
_queue
[:]
return
map
(
heapq
.
heappop
,
[
events
]
*
len
(
events
))
return
map
(
heapq
.
heappop
,
[
events
]
*
len
(
events
))
Misc/NEWS
Dosyayı görüntüle @
d07db96a
...
...
@@ -200,6 +200,8 @@ Core and Builtins
Library
-------
-
Issue
#
16640
:
Run
less
code
under
a
lock
in
sched
module
.
-
Issue
#
16165
:
Fix
sched
.
scheduler
.
run
()
method
was
block
a
scheduler
for
other
threads
.
...
...
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