From b1d23f9d9517b0d5f4092ef66b8ca9fd942b3e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 7 May 2019 17:16:43 +0200 Subject: [PATCH] Daemonize all threads to avoid breaking IOLoop exception handling (i.e tornado) --- pipe_io_server/pipe_io_server.py | 2 +- pipe_io_server/pipe_reader_thread.py | 2 +- pipe_io_server/pipe_writer_thread.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pipe_io_server/pipe_io_server.py b/pipe_io_server/pipe_io_server.py index acdbb00..a36b8f0 100644 --- a/pipe_io_server/pipe_io_server.py +++ b/pipe_io_server/pipe_io_server.py @@ -9,7 +9,7 @@ from .terminate_process_on_failure import terminate_process_on_failure class PipeIOServer(ABC, Thread): def __init__(self, in_pipe=None, out_pipe=None, permissions=0o600): - super().__init__() + super().__init__(daemon=True) self._in_pipe, self._out_pipe = in_pipe, out_pipe self._create_pipes(permissions) self._stop_event = Event() diff --git a/pipe_io_server/pipe_reader_thread.py b/pipe_io_server/pipe_reader_thread.py index 28b6818..4bce19d 100644 --- a/pipe_io_server/pipe_reader_thread.py +++ b/pipe_io_server/pipe_reader_thread.py @@ -11,7 +11,7 @@ class PipeReaderThread(Thread): stop_sequence = b'stop_reading\n' def __init__(self, pipe_path, stop_event, message_handler): - super().__init__() + super().__init__(daemon=True) self._message_handler = message_handler self._pipe_path = pipe_path self._stop_event = stop_event diff --git a/pipe_io_server/pipe_writer_thread.py b/pipe_io_server/pipe_writer_thread.py index 47305e4..3bc3fe7 100644 --- a/pipe_io_server/pipe_writer_thread.py +++ b/pipe_io_server/pipe_writer_thread.py @@ -9,7 +9,7 @@ from .deque import Deque class PipeWriterThread(Thread): def __init__(self, pipe_path, stop_event): - super().__init__() + super().__init__(daemon=True) self._pipe_path = pipe_path self._stop_event = stop_event self._write_queue = Deque()