def get_main_thread(): if hasattr(threading, 'main_thread'): return threading.main_thread() else: for t in threading.enumerate(): if isinstance(t, threading._MainThread): return t return None
def get_main_thread(): if hasattr(threading, 'main_thread'): return threading.main_thread() else: for t in threading.enumerate(): if isinstance(t, threading._MainThread): return t return None
def is_current_thread_main_thread(): if hasattr(threading, 'main_thread'): return threading.current_thread() is threading.main_thread() else: return isinstance(threading.current_thread(), threading._MainThread)
def is_current_thread_main_thread(): if hasattr(threading, 'main_thread'): return threading.current_thread() is threading.main_thread() else: return isinstance(threading.current_thread(), threading._MainThread)