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
a970c221
Kaydet (Commit)
a970c221
authored
Eki 08, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update docstring of sched, also remove an unused assignment.
üst
16fd6c46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
sched.py
Lib/sched.py
+6
-6
No files found.
Lib/sched.py
Dosyayı görüntüle @
a970c221
...
@@ -16,11 +16,11 @@ integers or floating point numbers, as long as it is consistent.
...
@@ -16,11 +16,11 @@ integers or floating point numbers, as long as it is consistent.
Events are specified by tuples (time, priority, action, argument).
Events are specified by tuples (time, priority, action, argument).
As in UNIX, lower priority numbers mean higher priority; in this
As in UNIX, lower priority numbers mean higher priority; in this
way the queue can be maintained as a priority queue. Execution of the
way the queue can be maintained as a priority queue. Execution of the
event means calling the action function, passing it the argument.
event means calling the action function, passing it the argument
Remember that in Python, multiple function arguments can be packed
sequence in "argument" (remember that in Python, multiple function
in a tuple. The action function may be an instance method so it
arguments are be packed in a sequence).
The action function may be an instance method so it
has another way to reference private data (besides global variables).
has another way to reference private data (besides global variables).
Parameterless functions or methods cannot be used, however.
"""
"""
# XXX The timefunc and delayfunc should have been defined as methods
# XXX The timefunc and delayfunc should have been defined as methods
...
@@ -89,7 +89,7 @@ class scheduler:
...
@@ -89,7 +89,7 @@ class scheduler:
exceptions are not caught but the scheduler's state remains
exceptions are not caught but the scheduler's state remains
well-defined so run() may be called again.
well-defined so run() may be called again.
A questionabl
y
hack is added to allow other threads to run:
A questionabl
e
hack is added to allow other threads to run:
just after an event is executed, a delay of 0 is executed, to
just after an event is executed, a delay of 0 is executed, to
avoid monopolizing the CPU when other threads are also
avoid monopolizing the CPU when other threads are also
runnable.
runnable.
...
@@ -111,7 +111,7 @@ class scheduler:
...
@@ -111,7 +111,7 @@ class scheduler:
# Verify that the event was not removed or altered
# Verify that the event was not removed or altered
# by another thread after we last looked at q[0].
# by another thread after we last looked at q[0].
if
event
is
checked_event
:
if
event
is
checked_event
:
void
=
action
(
*
argument
)
action
(
*
argument
)
delayfunc
(
0
)
# Let other threads run
delayfunc
(
0
)
# Let other threads run
else
:
else
:
heapq
.
heappush
(
event
)
heapq
.
heappush
(
event
)
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