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
bfccb35b
Kaydet (Commit)
bfccb35b
authored
Haz 29, 2003
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add settrace() and setprofile() functions to the threading library.
üst
c98ccfd2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
libthreading.tex
Doc/lib/libthreading.tex
+14
-0
threading.py
Lib/threading.py
+20
-0
No files found.
Doc/lib/libthreading.tex
Dosyayı görüntüle @
bfccb35b
...
...
@@ -90,6 +90,20 @@ subclassed in a limited fashion.
A thread that executes a function after a specified interval has passed.
\end{classdesc*}
\begin{funcdesc}
{
settrace
}{
func
}
Set a trace function
\index
{
trace function
}
for all threads started
from the
\module
{
threading
}
module. The
\var
{
func
}
will be passed to
\cfuntion
{
sys.settrace
}
for each thread, before its
\method
{
run
}
method is called.
\end{funcdesc}
\begin{funcdesc}
{
setprofile
}{
func
}
Set a profile function
\index
{
profile function
}
for all threads started
from the
\module
{
threading
}
module. The
\var
{
func
}
will be passed to
\cfuntion
{
sys.setprofile
}
for each thread, before its
\method
{
run
}
method is called.
\end{funcdesc}
Detailed interfaces for the objects are documented below.
The design of this module is loosely based on Java's threading model.
...
...
Lib/threading.py
Dosyayı görüntüle @
bfccb35b
...
...
@@ -52,6 +52,18 @@ else:
def
_note
(
self
,
*
args
):
pass
# Support for profile and trace hooks
_profile_hook
=
None
_trace_hook
=
None
def
setprofile
(
func
):
global
_profile_hook
_profile_hook
=
func
def
settrace
(
func
):
global
_trace_hook
_trace_hook
=
func
# Synchronization classes
...
...
@@ -408,6 +420,14 @@ class Thread(_Verbose):
_active_limbo_lock
.
release
()
if
__debug__
:
self
.
_note
(
"
%
s.__bootstrap(): thread started"
,
self
)
if
_trace_hook
:
self
.
_note
(
"
%
s.__bootstrap(): registering trace hook"
,
self
)
_sys
.
settrace
(
_trace_hook
)
if
_profile_hook
:
self
.
_note
(
"
%
s.__bootstrap(): registering profile hook"
,
self
)
_sys
.
setprofile
(
_profile_hook
)
try
:
self
.
run
()
except
SystemExit
:
...
...
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