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>
This commit is contained in:
1 parent
ea73386e5a
commit
9dd40f0723
1 file changed
+10
@@ -37,6 +37,16 @@ def threaded(func):
|
|||||||
return wrapper
|
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):
|
def notebook_init(verbose=True):
|
||||||
# Check system software and hardware
|
# Check system software and hardware
|
||||||
print('Checking setup...')
|
print('Checking setup...')
|
||||||
|
|||||||
Reference in new issue
Block a user