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
148724d3
Kaydet (Commit)
148724d3
authored
Tem 23, 2010
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Rip out old testing code that was inlined in threading.
Partially closes issue 9346. Thanks Brian Brazil for the patch.
üst
f079c57c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
88 deletions
+0
-88
threading.py
Lib/threading.py
+0
-88
No files found.
Lib/threading.py
Dosyayı görüntüle @
148724d3
...
...
@@ -871,91 +871,3 @@ def _after_fork():
_active
.
clear
()
_active
.
update
(
new_active
)
assert
len
(
_active
)
==
1
# Self-test code
def
_test
():
class
BoundedQueue
(
_Verbose
):
def
__init__
(
self
,
limit
):
_Verbose
.
__init__
(
self
)
self
.
mon
=
RLock
()
self
.
rc
=
Condition
(
self
.
mon
)
self
.
wc
=
Condition
(
self
.
mon
)
self
.
limit
=
limit
self
.
queue
=
deque
()
def
put
(
self
,
item
):
self
.
mon
.
acquire
()
while
len
(
self
.
queue
)
>=
self
.
limit
:
self
.
_note
(
"put(
%
s): queue full"
,
item
)
self
.
wc
.
wait
()
self
.
queue
.
append
(
item
)
self
.
_note
(
"put(
%
s): appended, length now
%
d"
,
item
,
len
(
self
.
queue
))
self
.
rc
.
notify
()
self
.
mon
.
release
()
def
get
(
self
):
self
.
mon
.
acquire
()
while
not
self
.
queue
:
self
.
_note
(
"get(): queue empty"
)
self
.
rc
.
wait
()
item
=
self
.
queue
.
popleft
()
self
.
_note
(
"get(): got
%
s,
%
d left"
,
item
,
len
(
self
.
queue
))
self
.
wc
.
notify
()
self
.
mon
.
release
()
return
item
class
ProducerThread
(
Thread
):
def
__init__
(
self
,
queue
,
quota
):
Thread
.
__init__
(
self
,
name
=
"Producer"
)
self
.
queue
=
queue
self
.
quota
=
quota
def
run
(
self
):
from
random
import
random
counter
=
0
while
counter
<
self
.
quota
:
counter
=
counter
+
1
self
.
queue
.
put
(
"
%
s.
%
d"
%
(
self
.
name
,
counter
))
_sleep
(
random
()
*
0.00001
)
class
ConsumerThread
(
Thread
):
def
__init__
(
self
,
queue
,
count
):
Thread
.
__init__
(
self
,
name
=
"Consumer"
)
self
.
queue
=
queue
self
.
count
=
count
def
run
(
self
):
while
self
.
count
>
0
:
item
=
self
.
queue
.
get
()
print
(
item
)
self
.
count
=
self
.
count
-
1
NP
=
3
QL
=
4
NI
=
5
Q
=
BoundedQueue
(
QL
)
P
=
[]
for
i
in
range
(
NP
):
t
=
ProducerThread
(
Q
,
NI
)
t
.
name
=
"Producer-
%
d"
%
(
i
+
1
)
P
.
append
(
t
)
C
=
ConsumerThread
(
Q
,
NI
*
NP
)
for
t
in
P
:
t
.
start
()
_sleep
(
0.000001
)
C
.
start
()
for
t
in
P
:
t
.
join
()
C
.
join
()
if
__name__
==
'__main__'
:
_test
()
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