Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b03ca4bc
Commit
b03ca4bc
authored
Jun 13, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix more threading API related bugs
parent
2d9a0864
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
27 additions
and
27 deletions
+27
-27
Lib/bsddb/test/test_associate.py
Lib/bsddb/test/test_associate.py
+1
-1
Lib/bsddb/test/test_join.py
Lib/bsddb/test/test_join.py
+1
-1
Lib/bsddb/test/test_lock.py
Lib/bsddb/test/test_lock.py
+3
-3
Lib/bsddb/test/test_thread.py
Lib/bsddb/test/test_thread.py
+11
-11
Lib/idlelib/rpc.py
Lib/idlelib/rpc.py
+6
-6
Lib/idlelib/run.py
Lib/idlelib/run.py
+2
-2
Lib/socketserver.py
Lib/socketserver.py
+1
-1
Lib/test/test_threadedtempfile.py
Lib/test/test_threadedtempfile.py
+1
-1
Lib/threading.py
Lib/threading.py
+1
-1
No files found.
Lib/bsddb/test/test_associate.py
View file @
b03ca4bc
...
...
@@ -9,7 +9,7 @@ import time
from
pprint
import
pprint
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
1
except
ImportError
:
have_threads
=
0
...
...
Lib/bsddb/test/test_join.py
View file @
b03ca4bc
...
...
@@ -8,7 +8,7 @@ import time
from
pprint
import
pprint
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
1
except
ImportError
:
have_threads
=
0
...
...
Lib/bsddb/test/test_lock.py
View file @
b03ca4bc
...
...
@@ -7,7 +7,7 @@ import tempfile
import
time
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
1
except
ImportError
:
have_threads
=
0
...
...
@@ -117,7 +117,7 @@ class LockingTestCase(unittest.TestCase):
deadlock_detection
.
end
=
False
deadlock_detection
.
count
=
0
t
=
Thread
(
target
=
deadlock_detection
)
t
.
set
D
aemon
(
True
)
t
.
set
_d
aemon
(
True
)
t
.
start
()
self
.
env
.
set_timeout
(
100000
,
db
.
DB_SET_LOCK_TIMEOUT
)
anID
=
self
.
env
.
lock_id
()
...
...
@@ -143,7 +143,7 @@ class LockingTestCase(unittest.TestCase):
self
.
assertTrue
(
deadlock_detection
.
count
>
0
)
def
theThread
(
self
,
sleepTime
,
lockType
):
name
=
current
Thread
().
getN
ame
()
name
=
current
_thread
().
get_n
ame
()
if
lockType
==
db
.
DB_LOCK_WRITE
:
lt
=
"write"
else
:
...
...
Lib/bsddb/test/test_thread.py
View file @
b03ca4bc
...
...
@@ -12,7 +12,7 @@ from random import random
DASH
=
b'-'
try
:
from
threading
import
Thread
,
current
T
hread
from
threading
import
Thread
,
current
_t
hread
have_threads
=
True
except
ImportError
:
have_threads
=
False
...
...
@@ -89,20 +89,20 @@ class BaseThreadedTestCase(unittest.TestCase):
self
.
_writerThread
(
*
args
,
**
kwargs
)
except
db
.
DBLockDeadlockError
:
if
verbose
:
print
(
current
Thread
().
getN
ame
(),
'died from'
,
e
)
print
(
current
_thread
().
get_n
ame
(),
'died from'
,
e
)
else
:
if
verbose
:
print
(
current
Thread
().
getN
ame
(),
"finished."
)
print
(
current
_thread
().
get_n
ame
(),
"finished."
)
def
readerThread
(
self
,
*
args
,
**
kwargs
):
try
:
self
.
_readerThread
(
*
args
,
**
kwargs
)
except
db
.
DBLockDeadlockError
as
e
:
if
verbose
:
print
(
current
Thread
().
getN
ame
(),
'died from'
,
e
)
print
(
current
_thread
().
get_n
ame
(),
'died from'
,
e
)
else
:
if
verbose
:
print
(
current
Thread
().
getN
ame
(),
"finished."
)
print
(
current
_thread
().
get_n
ame
(),
"finished."
)
...
...
@@ -143,7 +143,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase):
t
.
join
()
def
_writerThread
(
self
,
d
,
howMany
):
name
=
current
Thread
().
getN
ame
()
name
=
current
_thread
().
get_n
ame
()
start
=
0
stop
=
howMany
if
verbose
:
...
...
@@ -172,7 +172,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase):
def
_readerThread
(
self
,
d
,
readerNum
):
time
.
sleep
(
0.01
*
readerNum
)
name
=
current
Thread
().
getN
ame
()
name
=
current
_thread
().
get_n
ame
()
for
loop
in
range
(
5
):
c
=
d
.
cursor
()
...
...
@@ -240,7 +240,7 @@ class SimpleThreadedBase(BaseThreadedTestCase):
t
.
join
()
def
_writerThread
(
self
,
d
,
howMany
,
writerNum
):
name
=
current
Thread
().
getN
ame
()
name
=
current
_thread
().
get_n
ame
()
start
=
howMany
*
writerNum
stop
=
howMany
*
(
writerNum
+
1
)
-
1
if
verbose
:
...
...
@@ -286,7 +286,7 @@ class SimpleThreadedBase(BaseThreadedTestCase):
def
_readerThread
(
self
,
d
,
readerNum
):
time
.
sleep
(
0.01
*
readerNum
)
name
=
current
Thread
().
getN
ame
()
name
=
current
_thread
().
get_n
ame
()
for
loop
in
range
(
5
):
c
=
d
.
cursor
()
...
...
@@ -385,7 +385,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase):
time
.
sleep
(
0.05
)
def
_writerThread
(
self
,
d
,
howMany
,
writerNum
):
name
=
current
Thread
().
getN
ame
()
name
=
current
_thread
().
get_n
ame
()
start
=
howMany
*
writerNum
stop
=
howMany
*
(
writerNum
+
1
)
-
1
if
verbose
:
...
...
@@ -427,7 +427,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase):
def
_readerThread
(
self
,
d
,
readerNum
):
time
.
sleep
(
0.01
*
readerNum
+
0.05
)
name
=
current
Thread
().
getN
ame
()
name
=
current
_thread
().
get_n
ame
()
for
loop
in
range
(
5
):
finished
=
False
...
...
Lib/idlelib/rpc.py
View file @
b03ca4bc
...
...
@@ -106,7 +106,7 @@ class RPCServer(socketserver.TCPServer):
erf
=
sys
.
__stderr__
print
(
'
\
n
'
+
'-'
*
40
,
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
(
'Request: '
,
repr
(
request
),
file
=
erf
)
traceback
.
print_exc
(
file
=
erf
)
...
...
@@ -126,7 +126,7 @@ class SocketIO(object):
nextseq
=
0
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
:
self
.
debugging
=
debugging
self
.
sock
=
sock
...
...
@@ -149,7 +149,7 @@ class SocketIO(object):
def
debug
(
self
,
*
args
):
if
not
self
.
debugging
:
return
s
=
self
.
location
+
" "
+
str
(
threading
.
current
T
hread
().
getName
())
s
=
self
.
location
+
" "
+
str
(
threading
.
current
_t
hread
().
getName
())
for
a
in
args
:
s
=
s
+
" "
+
str
(
a
)
print
(
s
,
file
=
sys
.
__stderr__
)
...
...
@@ -218,7 +218,7 @@ class SocketIO(object):
def
asynccall
(
self
,
oid
,
methodname
,
args
,
kwargs
):
request
=
(
"CALL"
,
(
oid
,
methodname
,
args
,
kwargs
))
seq
=
self
.
newseq
()
if
threading
.
current
T
hread
()
!=
self
.
sockthread
:
if
threading
.
current
_t
hread
()
!=
self
.
sockthread
:
cvar
=
threading
.
Condition
()
self
.
cvars
[
seq
]
=
cvar
self
.
debug
((
"asynccall:%d:"
%
seq
),
oid
,
methodname
,
args
,
kwargs
)
...
...
@@ -228,7 +228,7 @@ class SocketIO(object):
def
asyncqueue
(
self
,
oid
,
methodname
,
args
,
kwargs
):
request
=
(
"QUEUE"
,
(
oid
,
methodname
,
args
,
kwargs
))
seq
=
self
.
newseq
()
if
threading
.
current
T
hread
()
!=
self
.
sockthread
:
if
threading
.
current
_t
hread
()
!=
self
.
sockthread
:
cvar
=
threading
.
Condition
()
self
.
cvars
[
seq
]
=
cvar
self
.
debug
((
"asyncqueue:%d:"
%
seq
),
oid
,
methodname
,
args
,
kwargs
)
...
...
@@ -294,7 +294,7 @@ class SocketIO(object):
def
_getresponse
(
self
,
myseq
,
wait
):
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
while
1
:
response
=
self
.
pollresponse
(
myseq
,
wait
)
...
...
Lib/idlelib/run.py
View file @
b03ca4bc
...
...
@@ -73,7 +73,7 @@ def main(del_exitfunc=False):
sockthread
=
threading
.
Thread
(
target
=
manage_socket
,
name
=
'SockThread'
,
args
=
((
LOCALHOST
,
port
),))
sockthread
.
set
D
aemon
(
True
)
sockthread
.
set
_d
aemon
(
True
)
sockthread
.
start
()
while
1
:
try
:
...
...
@@ -227,7 +227,7 @@ class MyRPCServer(rpc.RPCServer):
erf
=
sys
.
__stderr__
print
(
'
\
n
'
+
'-'
*
40
,
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
(
'Request: '
,
repr
(
request
),
file
=
erf
)
traceback
.
print_exc
(
file
=
erf
)
...
...
Lib/socketserver.py
View file @
b03ca4bc
...
...
@@ -566,7 +566,7 @@ class ThreadingMixIn:
t
=
threading
.
Thread
(
target
=
self
.
process_request_thread
,
args
=
(
request
,
client_address
))
if
self
.
daemon_threads
:
t
.
set
Daemon
(
1
)
t
.
set
_daemon
(
True
)
t
.
start
()
...
...
Lib/test/test_threadedtempfile.py
View file @
b03ca4bc
...
...
@@ -63,7 +63,7 @@ class ThreadedTempFileTest(unittest.TestCase):
t
.
join
()
ok
+=
t
.
ok_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
)
...
...
Lib/threading.py
View file @
b03ca4bc
...
...
@@ -856,7 +856,7 @@ def _test():
P
=
[]
for
i
in
range
(
NP
):
t
=
ProducerThread
(
Q
,
NI
)
t
.
set
N
ame
(
"Producer-%d"
%
(
i
+
1
))
t
.
set
_n
ame
(
"Producer-%d"
%
(
i
+
1
))
P
.
append
(
t
)
C
=
ConsumerThread
(
Q
,
NI
*
NP
)
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