TransRead: make the reader thread to be a daemon
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 4 Feb 2014 08:58:08 +0000 (10:58 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 4 Feb 2014 08:58:08 +0000 (10:58 +0200)
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 <artem.bityutskiy@intel.com>
bmaptools/TransRead.py

index 33ec0f47dd3f32dfaa765009dd547a85c89e3aac..6d142607ee33d444c400c97ae93b7f1f7260496f 100644 (file)
@@ -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