summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-18 18:09:21 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-18 18:09:21 (GMT)
commit727537077043bb03a0c9e537cacbb9e695f7f4a8 (patch)
tree7f6062facaa5dda6a57383ffe1a7d7cd6a91f703 /Lib
parentc16a7f3684290ddda130811912ae08a098df3d74 (diff)
downloadcpython-727537077043bb03a0c9e537cacbb9e695f7f4a8.zip
cpython-727537077043bb03a0c9e537cacbb9e695f7f4a8.tar.gz
cpython-727537077043bb03a0c9e537cacbb9e695f7f4a8.tar.bz2
Merged revisions 65824 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65824 | benjamin.peterson | 2008-08-18 13:01:43 -0500 (Mon, 18 Aug 2008) | 1 line change a few uses of the threading APIs ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/__init__.py2
-rw-r--r--Lib/multiprocessing/managers.py16
-rw-r--r--Lib/multiprocessing/queues.py2
-rw-r--r--Lib/test/test_dummy_threading.py6
-rw-r--r--Lib/test/test_multiprocessing.py4
-rw-r--r--Lib/test/test_socketserver.py2
6 files changed, 16 insertions, 16 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 9727d4f..bd6c7f2 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -258,7 +258,7 @@ class LogRecord:
self.relativeCreated = (self.created - _startTime) * 1000
if logThreads and thread:
self.thread = thread.get_ident()
- self.threadName = threading.current_thread().get_name()
+ self.threadName = threading.current_thread().name
else:
self.thread = None
self.threadName = None
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index a460edc..1fc7d6a 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -207,7 +207,7 @@ class Server(object):
Handle requests from the proxies in a particular process/thread
'''
util.debug('starting server thread to service %r',
- threading.current_thread().get_name())
+ threading.current_thread().name)
recv = conn.recv
send = conn.send
@@ -257,7 +257,7 @@ class Server(object):
except EOFError:
util.debug('got EOF -- exiting thread serving %r',
- threading.current_thread().get_name())
+ threading.current_thread().name)
sys.exit(0)
except Exception:
@@ -270,7 +270,7 @@ class Server(object):
send(('#UNSERIALIZABLE', repr(msg)))
except Exception as e:
util.info('exception in thread serving %r',
- threading.current_thread().get_name())
+ threading.current_thread().name)
util.info(' ... message was %r', msg)
util.info(' ... exception was %r', e)
conn.close()
@@ -392,7 +392,7 @@ class Server(object):
'''
Spawn a new thread to serve this connection
'''
- threading.current_thread().set_name(name)
+ threading.current_thread().name = name
c.send(('#RETURN', None))
self.serve_client(c)
@@ -706,8 +706,8 @@ class BaseProxy(object):
def _connect(self):
util.debug('making connection to manager')
name = current_process().get_name()
- if threading.current_thread().get_name() != 'MainThread':
- name += '|' + threading.current_thread().get_name()
+ if threading.current_thread().name != 'MainThread':
+ name += '|' + threading.current_thread().name
conn = self._Client(self._token.address, authkey=self._authkey)
dispatch(conn, None, 'accept_connection', (name,))
self._tls.connection = conn
@@ -720,7 +720,7 @@ class BaseProxy(object):
conn = self._tls.connection
except AttributeError:
util.debug('thread %r does not own a connection',
- threading.current_thread().get_name())
+ threading.current_thread().name)
self._connect()
conn = self._tls.connection
@@ -781,7 +781,7 @@ class BaseProxy(object):
# the process owns no more references to objects for this manager
if not idset and hasattr(tls, 'connection'):
util.debug('thread %r has no more proxies so closing conn',
- threading.current_thread().get_name())
+ threading.current_thread().name)
tls.connection.close()
del tls.connection
diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py
index 1c32dde..dce3aa6 100644
--- a/Lib/multiprocessing/queues.py
+++ b/Lib/multiprocessing/queues.py
@@ -155,7 +155,7 @@ class Queue(object):
self._wlock, self._writer.close),
name='QueueFeederThread'
)
- self._thread.set_daemon(True)
+ self._thread.daemon = True
debug('doing self._thread.start()')
self._thread.start()
diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py
index 86b3f35..6ec5da3 100644
--- a/Lib/test/test_dummy_threading.py
+++ b/Lib/test/test_dummy_threading.py
@@ -16,7 +16,7 @@ class DummyThreadingTestCase(unittest.TestCase):
#delay = random.random() * 2
delay = 0
if support.verbose:
- print('task', self.get_name(), 'will run for', delay, 'sec')
+ print('task', self.name, 'will run for', delay, 'sec')
sema.acquire()
mutex.acquire()
running += 1
@@ -25,11 +25,11 @@ class DummyThreadingTestCase(unittest.TestCase):
mutex.release()
time.sleep(delay)
if support.verbose:
- print('task', self.get_name(), 'done')
+ print('task', self.name, 'done')
mutex.acquire()
running -= 1
if support.verbose:
- print(self.get_name(), 'is finished.', running, 'tasks are running')
+ print(self.name, 'is finished.', running, 'tasks are running')
mutex.release()
sema.release()
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 078d7fa..5c1064a 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -671,7 +671,7 @@ class _TestCondition(BaseTestCase):
t = threading.Thread(target=self.f,
args=(cond, sleeping, woken, TIMEOUT1))
- t.set_daemon(True)
+ t.daemon = True
t.start()
# wait for them all to sleep
@@ -693,7 +693,7 @@ class _TestCondition(BaseTestCase):
p.start()
t = threading.Thread(target=self.f, args=(cond, sleeping, woken))
- t.set_daemon(True)
+ t.daemon = True
t.start()
# wait for them to all sleep
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 2427b8f..4ffea57 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -139,7 +139,7 @@ class SocketServerTest(unittest.TestCase):
# Time between requests is short enough that we won't wake
# up spuriously too many times.
kwargs={'poll_interval':0.01})
- t.set_daemon(True) # In case this function raises.
+ t.daemon = True # In case this function raises.
t.start()
if verbose: print("server running")
for i in range(3):