From f6415ae44454783d02c901815e5d0f6954a5cff7 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 9 Dec 2018 09:14:45 +0100 Subject: [PATCH] Optimize code --- resources/lib/backgroundthread.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/lib/backgroundthread.py b/resources/lib/backgroundthread.py index e27815e1..de4b5a55 100644 --- a/resources/lib/backgroundthread.py +++ b/resources/lib/backgroundthread.py @@ -110,9 +110,7 @@ class KillableThread(threading.Thread): """ Returns True if the thread is suspended """ - if self._suspended: - return True - return False + return self._suspended class Tasks(list): @@ -350,11 +348,13 @@ class BackgroundThreader: class ThreaderManager: - def __init__(self, worker=BackgroundWorker): + def __init__(self, worker=BackgroundWorker, worker_count=6): self.index = 0 self.abandoned = [] self._workerhandler = worker - self.threader = BackgroundThreader(name=str(self.index), worker=worker) + self.threader = BackgroundThreader(name=str(self.index), + worker=worker, + worker_count=worker_count) def __getattr__(self, name): return getattr(self.threader, name)