From ed62c1d01c8b46ce2d97a9ab657a07e76e78d858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sun, 23 Jun 2019 18:44:34 +0200 Subject: [PATCH] Simplify on_stop --- pipe_io_server/pipe_io_server.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pipe_io_server/pipe_io_server.py b/pipe_io_server/pipe_io_server.py index 02f12f6..1553999 100644 --- a/pipe_io_server/pipe_io_server.py +++ b/pipe_io_server/pipe_io_server.py @@ -1,5 +1,4 @@ from threading import Thread, Event -from typing import Callable from .pipe_reader_thread import PipeReaderThread from .pipe_writer_thread import PipeWriterThread @@ -13,7 +12,6 @@ class PipeIOServer(Thread): self._in_pipe, self._out_pipe = in_pipe, out_pipe self._create_pipes(permissions) self._stop_event = Event() - self._on_stop = lambda: None self._reader_thread, self._writer_thread = None, None self._io_threads = None @@ -66,14 +64,10 @@ class PipeIOServer(Thread): thread.stop() Pipe(self.in_pipe).remove() Pipe(self.out_pipe).remove() - self._on_stop() + self.on_stop() - def _set_on_stop(self, value): - if not isinstance(value, Callable): - raise ValueError("Supplied object is not callable!") - self._on_stop = value - - on_stop = property(fset=_set_on_stop) + def on_stop(self): + pass def wait(self): self._stop_event.wait()