[meld] matchers.helpers: Discard queued items that haven't been picked up
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] matchers.helpers: Discard queued items that haven't been picked up
- Date: Sun, 28 Jan 2018 22:14:25 +0000 (UTC)
commit 25248c52c25575a766c9be1c2db0e6c14e01fd27
Author: Kai Willadsen <kai willadsen gmail com>
Date: Mon Jan 29 08:08:50 2018 +1000
matchers.helpers: Discard queued items that haven't been picked up
In our worker model, we don't care even a little bit if some job that
gets queued by the main process gets dropped on the floor.
More importantly, if we *don't* do this, then quitting Meld while
highlighting jobs are still in the queue will absolutely deadlock the
process. I believe this is because the main process is waiting for
workers to read all of its items from the task queue before exiting,
but... the tools to debug this aren't great.
meld/matchers/helpers.py | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/meld/matchers/helpers.py b/meld/matchers/helpers.py
index 885d3291..e6502c86 100644
--- a/meld/matchers/helpers.py
+++ b/meld/matchers/helpers.py
@@ -57,11 +57,13 @@ class CachedSequenceMatcher(object):
self.scheduler = scheduler
self.cache = {}
self.tasks = multiprocessing.Queue()
+ self.tasks.cancel_join_thread()
# Limiting the result queue here has the effect of giving us
# much better interactivity. Without this limit, the
# result-checker tends to get starved and all highlights get
# delayed until we're almost completely finished.
self.results = multiprocessing.Queue(5)
+ self.results.cancel_join_thread()
self.thread = MatcherWorker(self.tasks, self.results)
self.task_id = 1
self.queued_matches = {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]