[Python-3000-checkins] r65825 - in python/branches/py3k: Lib/logging/__init__.py Lib/multiprocessing/managers.py Lib/multiprocessing/queues.py Lib/test/test_dummy_threading.py Lib/test/test_multiprocessing.py Lib/test/test_socketserver.py
benjamin.peterson
python-3000-checkins at python.org
Mon Aug 18 20:09:22 CEST 2008
Author: benjamin.peterson
Date: Mon Aug 18 20:09:21 2008
New Revision: 65825
Log:
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
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/logging/__init__.py
python/branches/py3k/Lib/multiprocessing/managers.py
python/branches/py3k/Lib/multiprocessing/queues.py
python/branches/py3k/Lib/test/test_dummy_threading.py
python/branches/py3k/Lib/test/test_multiprocessing.py
python/branches/py3k/Lib/test/test_socketserver.py
Modified: python/branches/py3k/Lib/logging/__init__.py
==============================================================================
--- python/branches/py3k/Lib/logging/__init__.py (original)
+++ python/branches/py3k/Lib/logging/__init__.py Mon Aug 18 20:09:21 2008
@@ -258,7 +258,7 @@
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
Modified: python/branches/py3k/Lib/multiprocessing/managers.py
==============================================================================
--- python/branches/py3k/Lib/multiprocessing/managers.py (original)
+++ python/branches/py3k/Lib/multiprocessing/managers.py Mon Aug 18 20:09:21 2008
@@ -207,7 +207,7 @@
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 @@
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 @@
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 @@
'''
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 @@
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 @@
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 @@
# 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
Modified: python/branches/py3k/Lib/multiprocessing/queues.py
==============================================================================
--- python/branches/py3k/Lib/multiprocessing/queues.py (original)
+++ python/branches/py3k/Lib/multiprocessing/queues.py Mon Aug 18 20:09:21 2008
@@ -155,7 +155,7 @@
self._wlock, self._writer.close),
name='QueueFeederThread'
)
- self._thread.set_daemon(True)
+ self._thread.daemon = True
debug('doing self._thread.start()')
self._thread.start()
Modified: python/branches/py3k/Lib/test/test_dummy_threading.py
==============================================================================
--- python/branches/py3k/Lib/test/test_dummy_threading.py (original)
+++ python/branches/py3k/Lib/test/test_dummy_threading.py Mon Aug 18 20:09:21 2008
@@ -16,7 +16,7 @@
#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 @@
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()
Modified: python/branches/py3k/Lib/test/test_multiprocessing.py
==============================================================================
--- python/branches/py3k/Lib/test/test_multiprocessing.py (original)
+++ python/branches/py3k/Lib/test/test_multiprocessing.py Mon Aug 18 20:09:21 2008
@@ -671,7 +671,7 @@
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 @@
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
Modified: python/branches/py3k/Lib/test/test_socketserver.py
==============================================================================
--- python/branches/py3k/Lib/test/test_socketserver.py (original)
+++ python/branches/py3k/Lib/test/test_socketserver.py Mon Aug 18 20:09:21 2008
@@ -139,7 +139,7 @@
# 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):
More information about the Python-3000-checkins
mailing list