change a few uses of the threading APIs

This commit is contained in:
Benjamin Peterson 2008-08-18 18:01:43 +00:00
parent cbae869759
commit a9b2222de4
6 changed files with 16 additions and 16 deletions

View file

@ -201,7 +201,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
@ -251,7 +251,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:
@ -264,7 +264,7 @@ class Server(object):
send(('#UNSERIALIZABLE', repr(msg)))
except Exception, 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()
@ -386,7 +386,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)
@ -700,8 +700,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
@ -714,7 +714,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
@ -775,7 +775,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