Optimize code

This commit is contained in:
croneter 2018-12-09 09:14:45 +01:00
parent 1ab1f18e07
commit f6415ae444

View file

@ -110,9 +110,7 @@ class KillableThread(threading.Thread):
""" """
Returns True if the thread is suspended Returns True if the thread is suspended
""" """
if self._suspended: return self._suspended
return True
return False
class Tasks(list): class Tasks(list):
@ -350,11 +348,13 @@ class BackgroundThreader:
class ThreaderManager: class ThreaderManager:
def __init__(self, worker=BackgroundWorker): def __init__(self, worker=BackgroundWorker, worker_count=6):
self.index = 0 self.index = 0
self.abandoned = [] self.abandoned = []
self._workerhandler = worker 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): def __getattr__(self, name):
return getattr(self.threader, name) return getattr(self.threader, name)