mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-26 10:00:37 +00:00
Implement worker thread as a daemon
This commit is contained in:
parent
e7eb5b6ea6
commit
9b9e29a3b6
@ -59,7 +59,7 @@ class WorkerThread(threading.Thread):
|
|||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
|
|
||||||
self.dequeued = list()
|
self.dequeued = list()
|
||||||
|
self.daemon = True
|
||||||
self.doLock = threading.Lock()
|
self.doLock = threading.Lock()
|
||||||
self.queue = ImprovedQueue()
|
self.queue = ImprovedQueue()
|
||||||
self.num = 0
|
self.num = 0
|
||||||
@ -101,10 +101,9 @@ class WorkerThread(threading.Thread):
|
|||||||
|
|
||||||
# Main thread loop starting the different tasks
|
# Main thread loop starting the different tasks
|
||||||
def run(self):
|
def run(self):
|
||||||
main_thread = _get_main_thread()
|
|
||||||
while main_thread.is_alive():
|
|
||||||
# this blocks until something is available
|
# this blocks until something is available
|
||||||
item = self.queue.get()
|
item = self.queue.get()
|
||||||
|
|
||||||
with self.doLock:
|
with self.doLock:
|
||||||
# add to list so that in-progress tasks show up
|
# add to list so that in-progress tasks show up
|
||||||
self.dequeued.append(item)
|
self.dequeued.append(item)
|
||||||
|
Loading…
Reference in New Issue
Block a user