diff options
author | Jonathan Slenders <jonathan@slenders.be> | 2016-12-28 14:35:09 +0100 |
---|---|---|
committer | Jonathan Slenders <jonathan@slenders.be> | 2016-12-28 14:35:09 +0100 |
commit | e4448ad723e34481cae29fecf1aacaf020b8bf37 (patch) | |
tree | dc54e61956282599af066360d1b9ae25ec3f4636 | |
parent | 9a79ca172891cf03995d75e044f5663ee3c10e17 (diff) |
Improved the patch-stdout.py example. Make the background thread a daemon.
-rwxr-xr-x | examples/patch-stdout.py | 4 |
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. |