Merge pull request #1086 from croneter/fix-thread
Fix PKC becoming unresponsive e.g. when switching the PMS
This commit is contained in:
commit
e8d601d7d7
2 changed files with 10 additions and 0 deletions
|
@ -65,6 +65,7 @@ class App(object):
|
||||||
self.threads.append(thread)
|
self.threads.append(thread)
|
||||||
|
|
||||||
def deregister_fanart_thread(self, thread):
|
def deregister_fanart_thread(self, thread):
|
||||||
|
self.fanart_thread.unblock_callers()
|
||||||
self.fanart_thread = None
|
self.fanart_thread = None
|
||||||
self.threads.remove(thread)
|
self.threads.remove(thread)
|
||||||
|
|
||||||
|
@ -85,6 +86,7 @@ class App(object):
|
||||||
self.threads.append(thread)
|
self.threads.append(thread)
|
||||||
|
|
||||||
def deregister_caching_thread(self, thread):
|
def deregister_caching_thread(self, thread):
|
||||||
|
self.caching_thread.unblock_callers()
|
||||||
self.caching_thread = None
|
self.caching_thread = None
|
||||||
self.threads.remove(thread)
|
self.threads.remove(thread)
|
||||||
|
|
||||||
|
@ -111,6 +113,7 @@ class App(object):
|
||||||
"""
|
"""
|
||||||
Sync thread has done it's work and is e.g. about to die
|
Sync thread has done it's work and is e.g. about to die
|
||||||
"""
|
"""
|
||||||
|
thread.unblock_callers()
|
||||||
self.threads.remove(thread)
|
self.threads.remove(thread)
|
||||||
|
|
||||||
def suspend_threads(self, block=True):
|
def suspend_threads(self, block=True):
|
||||||
|
|
|
@ -106,6 +106,13 @@ class KillableThread(threading.Thread):
|
||||||
"""
|
"""
|
||||||
return not self._is_not_asleep.is_set()
|
return not self._is_not_asleep.is_set()
|
||||||
|
|
||||||
|
def unblock_callers(self):
|
||||||
|
"""
|
||||||
|
Ensures that any other thread that requested this thread's suspension
|
||||||
|
is released
|
||||||
|
"""
|
||||||
|
self._suspension_reached.set()
|
||||||
|
|
||||||
|
|
||||||
class ProcessingQueue(Queue.Queue, object):
|
class ProcessingQueue(Queue.Queue, object):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue