Commit 2e154200 authored by Marius Gedminas's avatar Marius Gedminas

Give names to all the threads

parent 9442becb
...@@ -492,6 +492,7 @@ class ClientStorage(object): ...@@ -492,6 +492,7 @@ class ClientStorage(object):
check_blob_size_thread = threading.Thread( check_blob_size_thread = threading.Thread(
target=_check_blob_cache_size, target=_check_blob_cache_size,
args=(self.blob_dir, target), args=(self.blob_dir, target),
name="%s zeo client check blob size thread" % self.__name__,
) )
check_blob_size_thread.setDaemon(True) check_blob_size_thread.setDaemon(True)
check_blob_size_thread.start() check_blob_size_thread.start()
......
...@@ -333,6 +333,7 @@ class ZEOStorage: ...@@ -333,6 +333,7 @@ class ZEOStorage:
# If the client isn't waiting for a reply, start a thread # If the client isn't waiting for a reply, start a thread
# and forget about it. # and forget about it.
t = threading.Thread(target=self._pack_impl, args=(time,)) t = threading.Thread(target=self._pack_impl, args=(time,))
t.setName("zeo storage packing thread")
t.start() t.start()
return None return None
...@@ -915,6 +916,7 @@ class StorageServer: ...@@ -915,6 +916,7 @@ class StorageServer:
timeout = StubTimeoutThread() timeout = StubTimeoutThread()
else: else:
timeout = TimeoutThread(transaction_timeout) timeout = TimeoutThread(transaction_timeout)
timeout.setName("TimeoutThread for %s" % name)
timeout.start() timeout.start()
self.timeouts[name] = timeout self.timeouts[name] = timeout
if monitor_address: if monitor_address:
...@@ -1159,6 +1161,7 @@ class StorageServer: ...@@ -1159,6 +1161,7 @@ class StorageServer:
__thread = None __thread = None
def start_thread(self, daemon=True): def start_thread(self, daemon=True):
self.__thread = thread = threading.Thread(target=self.loop) self.__thread = thread = threading.Thread(target=self.loop)
thread.setName("StorageServer(%s)" % _addr_label(self.addr))
thread.setDaemon(daemon) thread.setDaemon(daemon)
thread.start() thread.start()
...@@ -1335,6 +1338,7 @@ class TimeoutThread(threading.Thread): ...@@ -1335,6 +1338,7 @@ class TimeoutThread(threading.Thread):
def __init__(self, timeout): def __init__(self, timeout):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.setName("TimeoutThread")
self.setDaemon(1) self.setDaemon(1)
self._timeout = timeout self._timeout = timeout
self._client = None self._client = None
...@@ -1405,6 +1409,7 @@ class SlowMethodThread(threading.Thread): ...@@ -1405,6 +1409,7 @@ class SlowMethodThread(threading.Thread):
def __init__(self, method, args): def __init__(self, method, args):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.setName("SlowMethodThread for %s" % method.__name__)
self._method = method self._method = method
self._args = args self._args = args
self.delay = MTDelay() self.delay = MTDelay()
......
...@@ -612,6 +612,7 @@ class ManagedServerConnection(Connection): ...@@ -612,6 +612,7 @@ class ManagedServerConnection(Connection):
self.call_from_thread = self.trigger.pull_trigger self.call_from_thread = self.trigger.pull_trigger
t = threading.Thread(target=server_loop, args=(map,)) t = threading.Thread(target=server_loop, args=(map,))
t.setName("ManagedServerConnection thread")
t.setDaemon(True) t.setDaemon(True)
t.start() t.start()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment