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
b03ca4bc
Kaydet (Commit)
b03ca4bc
authored
Haz 13, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix more threading API related bugs
üst
2d9a0864
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
27 additions
and
27 deletions
+27
-27
test_associate.py
Lib/bsddb/test/test_associate.py
+1
-1
test_join.py
Lib/bsddb/test/test_join.py
+1
-1
test_lock.py
Lib/bsddb/test/test_lock.py
+3
-3
test_thread.py
Lib/bsddb/test/test_thread.py
+11
-11
rpc.py
Lib/idlelib/rpc.py
+6
-6
run.py
Lib/idlelib/run.py
+2
-2
socketserver.py
Lib/socketserver.py
+1
-1
test_threadedtempfile.py
Lib/test/test_threadedtempfile.py
+1
-1
threading.py
Lib/threading.py
+1
-1
No files found.
Lib/bsddb/test/test_associate.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -9,7 +9,7 @@ import time
...
@@ -9,7 +9,7 @@ import time
from
pprint
import
pprint
from
pprint
import
pprint
try
:
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
1
have_threads
=
1
except
ImportError
:
except
ImportError
:
have_threads
=
0
have_threads
=
0
...
...
Lib/bsddb/test/test_join.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -8,7 +8,7 @@ import time
...
@@ -8,7 +8,7 @@ import time
from
pprint
import
pprint
from
pprint
import
pprint
try
:
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
1
have_threads
=
1
except
ImportError
:
except
ImportError
:
have_threads
=
0
have_threads
=
0
...
...
Lib/bsddb/test/test_lock.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -7,7 +7,7 @@ import tempfile
...
@@ -7,7 +7,7 @@ import tempfile
import
time
import
time
try
:
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
1
have_threads
=
1
except
ImportError
:
except
ImportError
:
have_threads
=
0
have_threads
=
0
...
@@ -117,7 +117,7 @@ class LockingTestCase(unittest.TestCase):
...
@@ -117,7 +117,7 @@ class LockingTestCase(unittest.TestCase):
deadlock_detection
.
end
=
False
deadlock_detection
.
end
=
False
deadlock_detection
.
count
=
0
deadlock_detection
.
count
=
0
t
=
Thread
(
target
=
deadlock_detection
)
t
=
Thread
(
target
=
deadlock_detection
)
t
.
set
D
aemon
(
True
)
t
.
set
_d
aemon
(
True
)
t
.
start
()
t
.
start
()
self
.
env
.
set_timeout
(
100000
,
db
.
DB_SET_LOCK_TIMEOUT
)
self
.
env
.
set_timeout
(
100000
,
db
.
DB_SET_LOCK_TIMEOUT
)
anID
=
self
.
env
.
lock_id
()
anID
=
self
.
env
.
lock_id
()
...
@@ -143,7 +143,7 @@ class LockingTestCase(unittest.TestCase):
...
@@ -143,7 +143,7 @@ class LockingTestCase(unittest.TestCase):
self
.
assertTrue
(
deadlock_detection
.
count
>
0
)
self
.
assertTrue
(
deadlock_detection
.
count
>
0
)
def
theThread
(
self
,
sleepTime
,
lockType
):
def
theThread
(
self
,
sleepTime
,
lockType
):
name
=
current
Thread
()
.
getN
ame
()
name
=
current
_thread
()
.
get_n
ame
()
if
lockType
==
db
.
DB_LOCK_WRITE
:
if
lockType
==
db
.
DB_LOCK_WRITE
:
lt
=
"write"
lt
=
"write"
else
:
else
:
...
...
Lib/bsddb/test/test_thread.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -12,7 +12,7 @@ from random import random
...
@@ -12,7 +12,7 @@ from random import random
DASH
=
b
'-'
DASH
=
b
'-'
try
:
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
True
have_threads
=
True
except
ImportError
:
except
ImportError
:
have_threads
=
False
have_threads
=
False
...
@@ -89,20 +89,20 @@ class BaseThreadedTestCase(unittest.TestCase):
...
@@ -89,20 +89,20 @@ class BaseThreadedTestCase(unittest.TestCase):
self
.
_writerThread
(
*
args
,
**
kwargs
)
self
.
_writerThread
(
*
args
,
**
kwargs
)
except
db
.
DBLockDeadlockError
:
except
db
.
DBLockDeadlockError
:
if
verbose
:
if
verbose
:
print
(
current
Thread
()
.
getN
ame
(),
'died from'
,
e
)
print
(
current
_thread
()
.
get_n
ame
(),
'died from'
,
e
)
else
:
else
:
if
verbose
:
if
verbose
:
print
(
current
Thread
()
.
getN
ame
(),
"finished."
)
print
(
current
_thread
()
.
get_n
ame
(),
"finished."
)
def
readerThread
(
self
,
*
args
,
**
kwargs
):
def
readerThread
(
self
,
*
args
,
**
kwargs
):
try
:
try
:
self
.
_readerThread
(
*
args
,
**
kwargs
)
self
.
_readerThread
(
*
args
,
**
kwargs
)
except
db
.
DBLockDeadlockError
as
e
:
except
db
.
DBLockDeadlockError
as
e
:
if
verbose
:
if
verbose
:
print
(
current
Thread
()
.
getN
ame
(),
'died from'
,
e
)
print
(
current
_thread
()
.
get_n
ame
(),
'died from'
,
e
)
else
:
else
:
if
verbose
:
if
verbose
:
print
(
current
Thread
()
.
getN
ame
(),
"finished."
)
print
(
current
_thread
()
.
get_n
ame
(),
"finished."
)
...
@@ -143,7 +143,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase):
...
@@ -143,7 +143,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase):
t
.
join
()
t
.
join
()
def
_writerThread
(
self
,
d
,
howMany
):
def
_writerThread
(
self
,
d
,
howMany
):
name
=
current
Thread
()
.
getN
ame
()
name
=
current
_thread
()
.
get_n
ame
()
start
=
0
start
=
0
stop
=
howMany
stop
=
howMany
if
verbose
:
if
verbose
:
...
@@ -172,7 +172,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase):
...
@@ -172,7 +172,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase):
def
_readerThread
(
self
,
d
,
readerNum
):
def
_readerThread
(
self
,
d
,
readerNum
):
time
.
sleep
(
0.01
*
readerNum
)
time
.
sleep
(
0.01
*
readerNum
)
name
=
current
Thread
()
.
getN
ame
()
name
=
current
_thread
()
.
get_n
ame
()
for
loop
in
range
(
5
):
for
loop
in
range
(
5
):
c
=
d
.
cursor
()
c
=
d
.
cursor
()
...
@@ -240,7 +240,7 @@ class SimpleThreadedBase(BaseThreadedTestCase):
...
@@ -240,7 +240,7 @@ class SimpleThreadedBase(BaseThreadedTestCase):
t
.
join
()
t
.
join
()
def
_writerThread
(
self
,
d
,
howMany
,
writerNum
):
def
_writerThread
(
self
,
d
,
howMany
,
writerNum
):
name
=
current
Thread
()
.
getN
ame
()
name
=
current
_thread
()
.
get_n
ame
()
start
=
howMany
*
writerNum
start
=
howMany
*
writerNum
stop
=
howMany
*
(
writerNum
+
1
)
-
1
stop
=
howMany
*
(
writerNum
+
1
)
-
1
if
verbose
:
if
verbose
:
...
@@ -286,7 +286,7 @@ class SimpleThreadedBase(BaseThreadedTestCase):
...
@@ -286,7 +286,7 @@ class SimpleThreadedBase(BaseThreadedTestCase):
def
_readerThread
(
self
,
d
,
readerNum
):
def
_readerThread
(
self
,
d
,
readerNum
):
time
.
sleep
(
0.01
*
readerNum
)
time
.
sleep
(
0.01
*
readerNum
)
name
=
current
Thread
()
.
getN
ame
()
name
=
current
_thread
()
.
get_n
ame
()
for
loop
in
range
(
5
):
for
loop
in
range
(
5
):
c
=
d
.
cursor
()
c
=
d
.
cursor
()
...
@@ -385,7 +385,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase):
...
@@ -385,7 +385,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase):
time
.
sleep
(
0.05
)
time
.
sleep
(
0.05
)
def
_writerThread
(
self
,
d
,
howMany
,
writerNum
):
def
_writerThread
(
self
,
d
,
howMany
,
writerNum
):
name
=
current
Thread
()
.
getN
ame
()
name
=
current
_thread
()
.
get_n
ame
()
start
=
howMany
*
writerNum
start
=
howMany
*
writerNum
stop
=
howMany
*
(
writerNum
+
1
)
-
1
stop
=
howMany
*
(
writerNum
+
1
)
-
1
if
verbose
:
if
verbose
:
...
@@ -427,7 +427,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase):
...
@@ -427,7 +427,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase):
def
_readerThread
(
self
,
d
,
readerNum
):
def
_readerThread
(
self
,
d
,
readerNum
):
time
.
sleep
(
0.01
*
readerNum
+
0.05
)
time
.
sleep
(
0.01
*
readerNum
+
0.05
)
name
=
current
Thread
()
.
getN
ame
()
name
=
current
_thread
()
.
get_n
ame
()
for
loop
in
range
(
5
):
for
loop
in
range
(
5
):
finished
=
False
finished
=
False
...
...
Lib/idlelib/rpc.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -106,7 +106,7 @@ class RPCServer(socketserver.TCPServer):
...
@@ -106,7 +106,7 @@ class RPCServer(socketserver.TCPServer):
erf
=
sys
.
__stderr__
erf
=
sys
.
__stderr__
print
(
'
\n
'
+
'-'
*
40
,
file
=
erf
)
print
(
'
\n
'
+
'-'
*
40
,
file
=
erf
)
print
(
'Unhandled server exception!'
,
file
=
erf
)
print
(
'Unhandled server exception!'
,
file
=
erf
)
print
(
'Thread:
%
s'
%
threading
.
current
Thread
()
.
getN
ame
(),
file
=
erf
)
print
(
'Thread:
%
s'
%
threading
.
current
_thread
()
.
get_n
ame
(),
file
=
erf
)
print
(
'Client Address: '
,
client_address
,
file
=
erf
)
print
(
'Client Address: '
,
client_address
,
file
=
erf
)
print
(
'Request: '
,
repr
(
request
),
file
=
erf
)
print
(
'Request: '
,
repr
(
request
),
file
=
erf
)
traceback
.
print_exc
(
file
=
erf
)
traceback
.
print_exc
(
file
=
erf
)
...
@@ -126,7 +126,7 @@ class SocketIO(object):
...
@@ -126,7 +126,7 @@ class SocketIO(object):
nextseq
=
0
nextseq
=
0
def
__init__
(
self
,
sock
,
objtable
=
None
,
debugging
=
None
):
def
__init__
(
self
,
sock
,
objtable
=
None
,
debugging
=
None
):
self
.
sockthread
=
threading
.
current
T
hread
()
self
.
sockthread
=
threading
.
current
_t
hread
()
if
debugging
is
not
None
:
if
debugging
is
not
None
:
self
.
debugging
=
debugging
self
.
debugging
=
debugging
self
.
sock
=
sock
self
.
sock
=
sock
...
@@ -149,7 +149,7 @@ class SocketIO(object):
...
@@ -149,7 +149,7 @@ class SocketIO(object):
def
debug
(
self
,
*
args
):
def
debug
(
self
,
*
args
):
if
not
self
.
debugging
:
if
not
self
.
debugging
:
return
return
s
=
self
.
location
+
" "
+
str
(
threading
.
current
T
hread
()
.
getName
())
s
=
self
.
location
+
" "
+
str
(
threading
.
current
_t
hread
()
.
getName
())
for
a
in
args
:
for
a
in
args
:
s
=
s
+
" "
+
str
(
a
)
s
=
s
+
" "
+
str
(
a
)
print
(
s
,
file
=
sys
.
__stderr__
)
print
(
s
,
file
=
sys
.
__stderr__
)
...
@@ -218,7 +218,7 @@ class SocketIO(object):
...
@@ -218,7 +218,7 @@ class SocketIO(object):
def
asynccall
(
self
,
oid
,
methodname
,
args
,
kwargs
):
def
asynccall
(
self
,
oid
,
methodname
,
args
,
kwargs
):
request
=
(
"CALL"
,
(
oid
,
methodname
,
args
,
kwargs
))
request
=
(
"CALL"
,
(
oid
,
methodname
,
args
,
kwargs
))
seq
=
self
.
newseq
()
seq
=
self
.
newseq
()
if
threading
.
current
T
hread
()
!=
self
.
sockthread
:
if
threading
.
current
_t
hread
()
!=
self
.
sockthread
:
cvar
=
threading
.
Condition
()
cvar
=
threading
.
Condition
()
self
.
cvars
[
seq
]
=
cvar
self
.
cvars
[
seq
]
=
cvar
self
.
debug
((
"asynccall:
%
d:"
%
seq
),
oid
,
methodname
,
args
,
kwargs
)
self
.
debug
((
"asynccall:
%
d:"
%
seq
),
oid
,
methodname
,
args
,
kwargs
)
...
@@ -228,7 +228,7 @@ class SocketIO(object):
...
@@ -228,7 +228,7 @@ class SocketIO(object):
def
asyncqueue
(
self
,
oid
,
methodname
,
args
,
kwargs
):
def
asyncqueue
(
self
,
oid
,
methodname
,
args
,
kwargs
):
request
=
(
"QUEUE"
,
(
oid
,
methodname
,
args
,
kwargs
))
request
=
(
"QUEUE"
,
(
oid
,
methodname
,
args
,
kwargs
))
seq
=
self
.
newseq
()
seq
=
self
.
newseq
()
if
threading
.
current
T
hread
()
!=
self
.
sockthread
:
if
threading
.
current
_t
hread
()
!=
self
.
sockthread
:
cvar
=
threading
.
Condition
()
cvar
=
threading
.
Condition
()
self
.
cvars
[
seq
]
=
cvar
self
.
cvars
[
seq
]
=
cvar
self
.
debug
((
"asyncqueue:
%
d:"
%
seq
),
oid
,
methodname
,
args
,
kwargs
)
self
.
debug
((
"asyncqueue:
%
d:"
%
seq
),
oid
,
methodname
,
args
,
kwargs
)
...
@@ -294,7 +294,7 @@ class SocketIO(object):
...
@@ -294,7 +294,7 @@ class SocketIO(object):
def
_getresponse
(
self
,
myseq
,
wait
):
def
_getresponse
(
self
,
myseq
,
wait
):
self
.
debug
(
"_getresponse:myseq:"
,
myseq
)
self
.
debug
(
"_getresponse:myseq:"
,
myseq
)
if
threading
.
current
T
hread
()
is
self
.
sockthread
:
if
threading
.
current
_t
hread
()
is
self
.
sockthread
:
# this thread does all reading of requests or responses
# this thread does all reading of requests or responses
while
1
:
while
1
:
response
=
self
.
pollresponse
(
myseq
,
wait
)
response
=
self
.
pollresponse
(
myseq
,
wait
)
...
...
Lib/idlelib/run.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -73,7 +73,7 @@ def main(del_exitfunc=False):
...
@@ -73,7 +73,7 @@ def main(del_exitfunc=False):
sockthread
=
threading
.
Thread
(
target
=
manage_socket
,
sockthread
=
threading
.
Thread
(
target
=
manage_socket
,
name
=
'SockThread'
,
name
=
'SockThread'
,
args
=
((
LOCALHOST
,
port
),))
args
=
((
LOCALHOST
,
port
),))
sockthread
.
set
D
aemon
(
True
)
sockthread
.
set
_d
aemon
(
True
)
sockthread
.
start
()
sockthread
.
start
()
while
1
:
while
1
:
try
:
try
:
...
@@ -227,7 +227,7 @@ class MyRPCServer(rpc.RPCServer):
...
@@ -227,7 +227,7 @@ class MyRPCServer(rpc.RPCServer):
erf
=
sys
.
__stderr__
erf
=
sys
.
__stderr__
print
(
'
\n
'
+
'-'
*
40
,
file
=
erf
)
print
(
'
\n
'
+
'-'
*
40
,
file
=
erf
)
print
(
'Unhandled server exception!'
,
file
=
erf
)
print
(
'Unhandled server exception!'
,
file
=
erf
)
print
(
'Thread:
%
s'
%
threading
.
current
Thread
()
.
getN
ame
(),
file
=
erf
)
print
(
'Thread:
%
s'
%
threading
.
current
_thread
()
.
get_n
ame
(),
file
=
erf
)
print
(
'Client Address: '
,
client_address
,
file
=
erf
)
print
(
'Client Address: '
,
client_address
,
file
=
erf
)
print
(
'Request: '
,
repr
(
request
),
file
=
erf
)
print
(
'Request: '
,
repr
(
request
),
file
=
erf
)
traceback
.
print_exc
(
file
=
erf
)
traceback
.
print_exc
(
file
=
erf
)
...
...
Lib/socketserver.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -566,7 +566,7 @@ class ThreadingMixIn:
...
@@ -566,7 +566,7 @@ class ThreadingMixIn:
t
=
threading
.
Thread
(
target
=
self
.
process_request_thread
,
t
=
threading
.
Thread
(
target
=
self
.
process_request_thread
,
args
=
(
request
,
client_address
))
args
=
(
request
,
client_address
))
if
self
.
daemon_threads
:
if
self
.
daemon_threads
:
t
.
set
Daemon
(
1
)
t
.
set
_daemon
(
True
)
t
.
start
()
t
.
start
()
...
...
Lib/test/test_threadedtempfile.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -63,7 +63,7 @@ class ThreadedTempFileTest(unittest.TestCase):
...
@@ -63,7 +63,7 @@ class ThreadedTempFileTest(unittest.TestCase):
t
.
join
()
t
.
join
()
ok
+=
t
.
ok_count
ok
+=
t
.
ok_count
if
t
.
error_count
:
if
t
.
error_count
:
errors
.
append
(
str
(
t
.
get
N
ame
())
+
str
(
t
.
errors
.
getvalue
()))
errors
.
append
(
str
(
t
.
get
_n
ame
())
+
str
(
t
.
errors
.
getvalue
()))
threading_cleanup
(
*
thread_info
)
threading_cleanup
(
*
thread_info
)
...
...
Lib/threading.py
Dosyayı görüntüle @
b03ca4bc
...
@@ -856,7 +856,7 @@ def _test():
...
@@ -856,7 +856,7 @@ def _test():
P
=
[]
P
=
[]
for
i
in
range
(
NP
):
for
i
in
range
(
NP
):
t
=
ProducerThread
(
Q
,
NI
)
t
=
ProducerThread
(
Q
,
NI
)
t
.
set
N
ame
(
"Producer-
%
d"
%
(
i
+
1
))
t
.
set
_n
ame
(
"Producer-
%
d"
%
(
i
+
1
))
P
.
append
(
t
)
P
.
append
(
t
)
C
=
ConsumerThread
(
Q
,
NI
*
NP
)
C
=
ConsumerThread
(
Q
,
NI
*
NP
)
for
t
in
P
:
for
t
in
P
:
...
...
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