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
bd9dd31a
Kaydet (Commit)
bd9dd31a
authored
Mar 31, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
take the usual lock precautions around _active_limbo_lock
üst
186188d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
21 deletions
+13
-21
threading.py
Lib/threading.py
+13
-21
No files found.
Lib/threading.py
Dosyayı görüntüle @
bd9dd31a
...
@@ -466,9 +466,8 @@ class Thread(_Verbose):
...
@@ -466,9 +466,8 @@ class Thread(_Verbose):
raise
RuntimeError
(
"thread already started"
)
raise
RuntimeError
(
"thread already started"
)
if
__debug__
:
if
__debug__
:
self
.
_note
(
"
%
s.start(): starting thread"
,
self
)
self
.
_note
(
"
%
s.start(): starting thread"
,
self
)
_active_limbo_lock
.
acquire
()
with
_active_limbo_lock
:
_limbo
[
self
]
=
self
_limbo
[
self
]
=
self
_active_limbo_lock
.
release
()
_start_new_thread
(
self
.
__bootstrap
,
())
_start_new_thread
(
self
.
__bootstrap
,
())
self
.
__started
.
wait
()
self
.
__started
.
wait
()
...
@@ -505,10 +504,9 @@ class Thread(_Verbose):
...
@@ -505,10 +504,9 @@ class Thread(_Verbose):
try
:
try
:
self
.
__ident
=
_get_ident
()
self
.
__ident
=
_get_ident
()
self
.
__started
.
set
()
self
.
__started
.
set
()
_active_limbo_lock
.
acquire
()
with
_active_limbo_lock
:
_active
[
self
.
__ident
]
=
self
_active
[
self
.
__ident
]
=
self
del
_limbo
[
self
]
del
_limbo
[
self
]
_active_limbo_lock
.
release
()
if
__debug__
:
if
__debug__
:
self
.
_note
(
"
%
s.__bootstrap(): thread started"
,
self
)
self
.
_note
(
"
%
s.__bootstrap(): thread started"
,
self
)
...
@@ -735,9 +733,8 @@ class _MainThread(Thread):
...
@@ -735,9 +733,8 @@ class _MainThread(Thread):
def
__init__
(
self
):
def
__init__
(
self
):
Thread
.
__init__
(
self
,
name
=
"MainThread"
)
Thread
.
__init__
(
self
,
name
=
"MainThread"
)
self
.
_Thread__started
.
set
()
self
.
_Thread__started
.
set
()
_active_limbo_lock
.
acquire
()
with
_active_limbo_lock
:
_active
[
_get_ident
()]
=
self
_active
[
_get_ident
()]
=
self
_active_limbo_lock
.
release
()
def
_set_daemon
(
self
):
def
_set_daemon
(
self
):
return
False
return
False
...
@@ -781,9 +778,8 @@ class _DummyThread(Thread):
...
@@ -781,9 +778,8 @@ class _DummyThread(Thread):
del
self
.
_Thread__block
del
self
.
_Thread__block
self
.
_Thread__started
.
set
()
self
.
_Thread__started
.
set
()
_active_limbo_lock
.
acquire
()
with
_active_limbo_lock
:
_active
[
_get_ident
()]
=
self
_active
[
_get_ident
()]
=
self
_active_limbo_lock
.
release
()
def
_set_daemon
(
self
):
def
_set_daemon
(
self
):
return
True
return
True
...
@@ -804,18 +800,14 @@ def currentThread():
...
@@ -804,18 +800,14 @@ def currentThread():
current_thread
=
currentThread
current_thread
=
currentThread
def
activeCount
():
def
activeCount
():
_active_limbo_lock
.
acquire
()
with
_active_limbo_lock
:
count
=
len
(
_active
)
+
len
(
_limbo
)
return
len
(
_active
)
+
len
(
_limbo
)
_active_limbo_lock
.
release
()
return
count
active_count
=
activeCount
active_count
=
activeCount
def
enumerate
():
def
enumerate
():
_active_limbo_lock
.
acquire
()
with
_active_limbo_lock
:
active
=
_active
.
values
()
+
_limbo
.
values
()
return
_active
.
values
()
+
_limbo
.
values
()
_active_limbo_lock
.
release
()
return
active
from
thread
import
stack_size
from
thread
import
stack_size
...
...
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