Name threadpools

This commit is contained in:
shortcutme 2019-12-17 14:43:33 +01:00
parent 4c31aae97b
commit c1df78b97f
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
2 changed files with 7 additions and 3 deletions

View File

@ -20,8 +20,8 @@ from Plugin import PluginManager
from Translate import translate as _
thread_pool_fs_read = ThreadPool.ThreadPool(config.threads_fs_read)
thread_pool_fs_write = ThreadPool.ThreadPool(config.threads_fs_write)
thread_pool_fs_read = ThreadPool.ThreadPool(config.threads_fs_read, name="FS read")
thread_pool_fs_write = ThreadPool.ThreadPool(config.threads_fs_write, name="FS write")
thread_pool_fs_batch = ThreadPool.ThreadPool(1, name="FS batch")

View File

@ -4,8 +4,12 @@ import threading
class ThreadPool:
def __init__(self, max_size):
def __init__(self, max_size, name=None):
self.setMaxSize(max_size)
if name:
self.name = name
else:
self.name = "ThreadPool#%s" % id(self)
def setMaxSize(self, max_size):
self.max_size = max_size