From 3f08daeb241ba91a2d24d909e403fe6b1136226d Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 19 Apr 2023 12:38:28 -0400 Subject: [PATCH] Join threads at end of multi-threading example (#1934) --- examples/python/multithreading/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/python/multithreading/main.py b/examples/python/multithreading/main.py index 35c1a674ed71..61244e1722b3 100755 --- a/examples/python/multithreading/main.py +++ b/examples/python/multithreading/main.py @@ -27,11 +27,16 @@ def main() -> None: rr.script_setup(args, "multithreading") + threads = [] for i in range(10): t = threading.Thread( target=rect_logger, args=("thread/{}".format(i), [random.randrange(255) for _ in range(3)]) ) t.start() + threads.append(t) + + for t in threads: + t.join() rr.script_teardown(args)