Name threadpools
This commit is contained in:
parent
4c31aae97b
commit
c1df78b97f
2 changed files with 7 additions and 3 deletions
|
@ -20,8 +20,8 @@ from Plugin import PluginManager
|
||||||
from Translate import translate as _
|
from Translate import translate as _
|
||||||
|
|
||||||
|
|
||||||
thread_pool_fs_read = ThreadPool.ThreadPool(config.threads_fs_read)
|
thread_pool_fs_read = ThreadPool.ThreadPool(config.threads_fs_read, name="FS read")
|
||||||
thread_pool_fs_write = ThreadPool.ThreadPool(config.threads_fs_write)
|
thread_pool_fs_write = ThreadPool.ThreadPool(config.threads_fs_write, name="FS write")
|
||||||
thread_pool_fs_batch = ThreadPool.ThreadPool(1, name="FS batch")
|
thread_pool_fs_batch = ThreadPool.ThreadPool(1, name="FS batch")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,12 @@ import threading
|
||||||
|
|
||||||
|
|
||||||
class ThreadPool:
|
class ThreadPool:
|
||||||
def __init__(self, max_size):
|
def __init__(self, max_size, name=None):
|
||||||
self.setMaxSize(max_size)
|
self.setMaxSize(max_size)
|
||||||
|
if name:
|
||||||
|
self.name = name
|
||||||
|
else:
|
||||||
|
self.name = "ThreadPool#%s" % id(self)
|
||||||
|
|
||||||
def setMaxSize(self, max_size):
|
def setMaxSize(self, max_size):
|
||||||
self.max_size = max_size
|
self.max_size = max_size
|
||||||
|
|
Loading…
Reference in a new issue