From 1ff83e0cbc225d2495eb768311a9c21ac6d37433 Mon Sep 17 00:00:00 2001 From: petrcermak Date: Mon, 19 Jan 2015 06:51:16 -0800 Subject: Remove background_tasks.TerminateAll() function from Memory Inspector Now that background tasks are threads, there is no direct way to terminate them. Instead, we set them to be daemon threads which will be automatically terminated when the main program exits. BUG=448399 Review URL: https://codereview.chromium.org/845733003 Cr-Commit-Position: refs/heads/master@{#312111} --- .../memory_inspector/frontends/background_tasks.py | 8 +------- tools/memory_inspector/memory_inspector/frontends/www_server.py | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'tools/memory_inspector') diff --git a/tools/memory_inspector/memory_inspector/frontends/background_tasks.py b/tools/memory_inspector/memory_inspector/frontends/background_tasks.py index 43e5f66..923fcf0 100644 --- a/tools/memory_inspector/memory_inspector/frontends/background_tasks.py +++ b/tools/memory_inspector/memory_inspector/frontends/background_tasks.py @@ -51,13 +51,6 @@ def Get(task_id): return _tasks.get(task_id) -def TerminateAll(): - for task in _tasks.itervalues(): - if task.is_alive(): - task.terminate() - _tasks.clear() - - def TracerMain_(log, storage_path, backend_name, device_id, pid, interval, count, trace_native_heap): """Entry point for the background periodic tracer task.""" @@ -140,6 +133,7 @@ class BackgroundTask(threading.Thread): target=entry_point, args=((self._log_queue,) + args), # Just propagate all args. kwargs=kwargs) + self.daemon = True def run(self): try: diff --git a/tools/memory_inspector/memory_inspector/frontends/www_server.py b/tools/memory_inspector/memory_inspector/frontends/www_server.py index c79112f..f8368fb 100644 --- a/tools/memory_inspector/memory_inspector/frontends/www_server.py +++ b/tools/memory_inspector/memory_inspector/frontends/www_server.py @@ -758,4 +758,3 @@ def Start(http_port): httpd.serve_forever() except KeyboardInterrupt: pass # Don't print useless stack traces when the user hits CTRL-C. - background_tasks.TerminateAll() -- cgit v1.1