Do not instantiate xbmc.Monitor() if possible (guess this leads to issues if we should shut down)
This commit is contained in:
parent
97c3239657
commit
da671c8ee5
2 changed files with 5 additions and 7 deletions
|
@ -134,7 +134,7 @@ class App(object):
|
|||
thread.suspend(block=True)
|
||||
else:
|
||||
break
|
||||
return xbmc.Monitor().abortRequested()
|
||||
return self.monitor.abortRequested()
|
||||
|
||||
def resume_threads(self):
|
||||
"""
|
||||
|
@ -144,7 +144,7 @@ class App(object):
|
|||
LOG.debug('Resuming threads: %s', self.threads)
|
||||
for thread in self.threads:
|
||||
thread.resume()
|
||||
return xbmc.Monitor().abortRequested()
|
||||
return self.monitor.abortRequested()
|
||||
|
||||
def stop_threads(self, block=True):
|
||||
"""
|
||||
|
|
|
@ -8,8 +8,6 @@ import Queue
|
|||
import heapq
|
||||
from collections import deque
|
||||
|
||||
import xbmc
|
||||
|
||||
from . import utils, app, variables as v
|
||||
|
||||
WORKER_COUNT = 3
|
||||
|
@ -305,7 +303,7 @@ class Task(object):
|
|||
self._canceled = True
|
||||
|
||||
def should_cancel(self):
|
||||
return self._canceled or xbmc.Monitor().abortRequested()
|
||||
return self._canceled or app.APP.monitor.abortRequested()
|
||||
|
||||
def isValid(self):
|
||||
return not self.finished and not self._canceled
|
||||
|
@ -370,7 +368,7 @@ class BackgroundWorker(object):
|
|||
return self
|
||||
|
||||
def aborted(self):
|
||||
return self._abort or xbmc.Monitor().abortRequested()
|
||||
return self._abort or app.APP.monitor.abortRequested()
|
||||
|
||||
def start(self):
|
||||
if self._thread and self._thread.isAlive():
|
||||
|
@ -452,7 +450,7 @@ class BackgroundThreader:
|
|||
return self
|
||||
|
||||
def aborted(self):
|
||||
return self._abort or xbmc.Monitor().abortRequested()
|
||||
return self._abort or app.APP.monitor.abortRequested()
|
||||
|
||||
def shutdown(self, block=True):
|
||||
self.abort()
|
||||
|
|
Loading…
Reference in a new issue