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
b00b596c
Kaydet (Commit)
b00b596c
authored
Nis 22, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #11714: Use 'with' statements to assure a Semaphore releases a
condition variable. Original patch by Thomas Rachel.
üst
fcd9f222
81a5855a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
20 deletions
+22
-20
threading.py
Lib/threading.py
+18
-20
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/threading.py
Dosyayı görüntüle @
b00b596c
...
@@ -253,31 +253,29 @@ class Semaphore:
...
@@ -253,31 +253,29 @@ class Semaphore:
raise
ValueError
(
"can't specify timeout for non-blocking acquire"
)
raise
ValueError
(
"can't specify timeout for non-blocking acquire"
)
rc
=
False
rc
=
False
endtime
=
None
endtime
=
None
self
.
_cond
.
acquire
()
with
self
.
_cond
:
while
self
.
_value
==
0
:
while
self
.
_value
==
0
:
if
not
blocking
:
if
not
blocking
:
break
break
if
timeout
is
not
None
:
if
timeout
is
not
None
:
if
endtime
is
None
:
if
endtime
is
None
:
endtime
=
_time
()
+
timeout
endtime
=
_time
()
+
timeout
else
:
else
:
timeout
=
endtime
-
_time
()
timeout
=
endtime
-
_time
()
if
timeout
<=
0
:
if
timeout
<=
0
:
break
break
self
.
_cond
.
wait
(
timeout
)
self
.
_cond
.
wait
(
timeout
)
else
:
else
:
self
.
_value
-=
1
self
.
_value
-=
1
rc
=
True
rc
=
True
self
.
_cond
.
release
()
return
rc
return
rc
__enter__
=
acquire
__enter__
=
acquire
def
release
(
self
):
def
release
(
self
):
self
.
_cond
.
acquire
()
with
self
.
_cond
:
self
.
_value
+=
1
self
.
_value
+=
1
self
.
_cond
.
notify
()
self
.
_cond
.
notify
()
self
.
_cond
.
release
()
def
__exit__
(
self
,
t
,
v
,
tb
):
def
__exit__
(
self
,
t
,
v
,
tb
):
self
.
release
()
self
.
release
()
...
...
Misc/ACKS
Dosyayı görüntüle @
b00b596c
...
@@ -993,6 +993,7 @@ Fernando Pérez
...
@@ -993,6 +993,7 @@ Fernando Pérez
Pierre Quentel
Pierre Quentel
Brian Quinlan
Brian Quinlan
Anders Qvist
Anders Qvist
Thomas Rachel
Ram Rachum
Ram Rachum
Jérôme Radix
Jérôme Radix
Burton Radons
Burton Radons
...
...
Misc/NEWS
Dosyayı görüntüle @
b00b596c
...
@@ -49,6 +49,9 @@ Core and Builtins
...
@@ -49,6 +49,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #11714: Use '
with
' statements to assure a Semaphore releases a
condition variable. Original patch by Thomas Rachel.
- Issue #16624: `subprocess.check_output` now accepts an `input` argument,
- Issue #16624: `subprocess.check_output` now accepts an `input` argument,
allowing the subprocess'
s
stdin
to
be
provided
as
a
(
byte
)
string
.
allowing the subprocess'
s
stdin
to
be
provided
as
a
(
byte
)
string
.
Patch
by
Zack
Weinberg
.
Patch
by
Zack
Weinberg
.
...
...
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