mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix problem in FunctionDispatcher where it hangs if calling thread == called thread.
This commit is contained in:
parent
0338744cb8
commit
07b12774b4
@ -305,8 +305,11 @@ class FunctionDispatcher(QObject):
|
||||
self.dispatch_signal.connect(self.dispatch, type=typ)
|
||||
self.q = Queue.Queue()
|
||||
self.lock = threading.Lock()
|
||||
self.calling_thread = QThread.currentThread()
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
if self.calling_thread == QThread.currentThread():
|
||||
return self.func(*args, **kwargs)
|
||||
with self.lock:
|
||||
self.dispatch_signal.emit(self.q, args, kwargs)
|
||||
res = self.q.get()
|
||||
|
Loading…
x
Reference in New Issue
Block a user