Add `join_threads()` (#10086)

* Update __init__.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update __init__.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update __init__.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/10163/head^2
Glenn Jocher 2022-11-15 16:27:07 +01:00 committed by GitHub
parent ea73386e5a
commit 9dd40f0723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,16 @@ def threaded(func):
return wrapper
def join_threads(verbose=False):
# Join all daemon threads, i.e. atexit.register(lambda: join_threads())
main_thread = threading.current_thread()
for t in threading.enumerate():
if t is not main_thread:
if verbose:
print(f'Joining thread {t.name}')
t.join()
def notebook_init(verbose=True):
# Check system software and hardware
print('Checking setup...')