From 0d9828002ba4c8ec5bd979cb07ea27f4a2d09a18 Mon Sep 17 00:00:00 2001 From: calvin Date: Thu, 19 Feb 2009 08:15:32 +0000 Subject: [PATCH] Added flag to stop checking from another thread. git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3970 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/director/__init__.py | 3 +++ linkcheck/director/aggregator.py | 1 + 2 files changed, 4 insertions(+) diff --git a/linkcheck/director/__init__.py b/linkcheck/director/__init__.py index 7fce5fb3..f7e837b3 100644 --- a/linkcheck/director/__init__.py +++ b/linkcheck/director/__init__.py @@ -62,6 +62,9 @@ def check_url (aggregate): aggregate.remove_stopped_threads() if not aggregate.threads: break + if aggregate.wanted_stop: + # some other thread wants us to stop + raise KeyboardInterrupt def interrupt (aggregate): diff --git a/linkcheck/director/aggregator.py b/linkcheck/director/aggregator.py index 2383f321..af416451 100644 --- a/linkcheck/director/aggregator.py +++ b/linkcheck/director/aggregator.py @@ -39,6 +39,7 @@ class Aggregate (object): self.logger = logger.Logger(config) self.threads = [] self.last_w3_call = 0 + self.wanted_stop = False def start_threads (self): """Spawn threads for URL checking and status printing."""