Skip to content

Commit

Permalink
Give names to all the threads
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed May 22, 2013
1 parent 9442bec commit 2e15420
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ZEO/ClientStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ def _check_blob_size(self, bytes=None):
check_blob_size_thread = threading.Thread(
target=_check_blob_cache_size,
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.start()
Expand Down
5 changes: 5 additions & 0 deletions src/ZEO/StorageServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ def pack(self, time, wait=1):
# If the client isn't waiting for a reply, start a thread
# and forget about it.
t = threading.Thread(target=self._pack_impl, args=(time,))
t.setName("zeo storage packing thread")
t.start()
return None

Expand Down Expand Up @@ -915,6 +916,7 @@ def __init__(self, addr, storages,
timeout = StubTimeoutThread()
else:
timeout = TimeoutThread(transaction_timeout)
timeout.setName("TimeoutThread for %s" % name)
timeout.start()
self.timeouts[name] = timeout
if monitor_address:
Expand Down Expand Up @@ -1159,6 +1161,7 @@ def loop(self):
__thread = None
def start_thread(self, daemon=True):
self.__thread = thread = threading.Thread(target=self.loop)
thread.setName("StorageServer(%s)" % _addr_label(self.addr))
thread.setDaemon(daemon)
thread.start()

Expand Down Expand Up @@ -1335,6 +1338,7 @@ class TimeoutThread(threading.Thread):

def __init__(self, timeout):
threading.Thread.__init__(self)
self.setName("TimeoutThread")
self.setDaemon(1)
self._timeout = timeout
self._client = None
Expand Down Expand Up @@ -1405,6 +1409,7 @@ class SlowMethodThread(threading.Thread):

def __init__(self, method, args):
threading.Thread.__init__(self)
self.setName("SlowMethodThread for %s" % method.__name__)
self._method = method
self._args = args
self.delay = MTDelay()
Expand Down
1 change: 1 addition & 0 deletions src/ZEO/zrpc/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ def __init__(self, sock, addr, obj, mgr):
self.call_from_thread = self.trigger.pull_trigger

t = threading.Thread(target=server_loop, args=(map,))
t.setName("ManagedServerConnection thread")
t.setDaemon(True)
t.start()

Expand Down

0 comments on commit 2e15420

Please sign in to comment.