From 01f547f23d5d78a4b6f4501c6c504a0b546a44f3 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 4 Feb 2014 10:58:08 +0200 Subject: [PATCH] TransRead: make the reader thread to be a daemon Mark the reader thread as "daemon", which means that when the main script exits, the thread will be just killed instead of blocking the entire script. This change makes bmaptool exit immediately on Ctrl-C. Without this change, bmaptool is blocked for some times because the reader thread is blocked, because it is reading data via a very slow link. It is fine to just kill it in this case, instead of waiting. Change-Id: I66628dc19bff6ef75e45394432b7dacdca3e2b6a Signed-off-by: Artem Bityutskiy --- bmaptools/TransRead.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bmaptools/TransRead.py b/bmaptools/TransRead.py index 33ec0f4..6d14260 100644 --- a/bmaptools/TransRead.py +++ b/bmaptools/TransRead.py @@ -348,6 +348,7 @@ class TransRead(object): args = (self._f_objs[-1], child_process.stdin, ) self._rthread = threading.Thread(target=self._read_thread, args=args) + self._rthread.daemon = True self._rthread.start() self._force_fake_seek = True -- 2.34.1