better main-thread detection

This commit is contained in:
Damian Stewart 2023-01-30 11:32:39 +01:00
parent 50a71e63b6
commit 86a5004098
1 changed files with 2 additions and 1 deletions

View File

@ -677,7 +677,8 @@ def main(args):
""" """
handles sigterm handles sigterm
""" """
if threading.current_thread().__class__.__name__ == '_MainThread': is_main_thread = (torch.utils.data.get_worker_info() == None)
if is_main_thread:
global interrupted global interrupted
if not interrupted: if not interrupted:
interrupted=True interrupted=True