mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-21 15:14:13 +00:00
Introduce a priority thread pool
This pool is meant to be used for threads where the user expects a response as fast as possible.
This commit is contained in:
committed by
Philipp Wolfer
parent
de4bf2029a
commit
f1248b487f
@@ -160,6 +160,12 @@ class Tagger(QtWidgets.QApplication):
|
||||
# It's a valid reference, but its start() method doesn't work.
|
||||
self.thread_pool = QtCore.QThreadPool(self)
|
||||
|
||||
# Provide a separate thread pool for operations that should not be
|
||||
# delayed by longer background processing tasks, e.g. because the user
|
||||
# expects instant feedback instead of waiting for a long list of
|
||||
# operations to finish.
|
||||
self.priority_thread_pool = QtCore.QThreadPool(self)
|
||||
|
||||
# Use a separate thread pool for file saving, with a thread count of 1,
|
||||
# to avoid race conditions in File._save_and_rename.
|
||||
self.save_thread_pool = QtCore.QThreadPool(self)
|
||||
@@ -341,6 +347,7 @@ class Tagger(QtWidgets.QApplication):
|
||||
self._acoustid.done()
|
||||
self.thread_pool.waitForDone()
|
||||
self.save_thread_pool.waitForDone()
|
||||
self.priority_thread_pool.waitForDone()
|
||||
self.browser_integration.stop()
|
||||
self.webservice.stop()
|
||||
self.run_cleanup()
|
||||
|
||||
@@ -446,7 +446,8 @@ class MetadataBox(QtWidgets.QTableWidget):
|
||||
return
|
||||
if self.selection_dirty:
|
||||
self._update_selection()
|
||||
thread.run_task(self._update_tags, self._update_items)
|
||||
thread.run_task(self._update_tags, self._update_items,
|
||||
thread_pool=self.tagger.priority_thread_pool)
|
||||
|
||||
def _update_tags(self):
|
||||
self.selection_mutex.lock()
|
||||
|
||||
Reference in New Issue
Block a user