summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Slenders <jonathan@slenders.be>2016-12-28 14:35:09 +0100
committerJonathan Slenders <jonathan@slenders.be>2016-12-28 14:35:09 +0100
commite4448ad723e34481cae29fecf1aacaf020b8bf37 (patch)
treedc54e61956282599af066360d1b9ae25ec3f4636
parent9a79ca172891cf03995d75e044f5663ee3c10e17 (diff)
Improved the patch-stdout.py example. Make the background thread a daemon.
-rwxr-xr-xexamples/patch-stdout.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/patch-stdout.py b/examples/patch-stdout.py
index 23eb3ff7..6dc38f03 100755
--- a/examples/patch-stdout.py
+++ b/examples/patch-stdout.py
@@ -22,7 +22,9 @@ def main():
i += 1
print('i=%i' % i)
time.sleep(1)
- threading.Thread(target=thread).start()
+ t = threading.Thread(target=thread)
+ t.daemon = True
+ t.start()
# Now read the input. The print statements of the other thread
# should not disturb anything.