X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=thread_utils.py;h=0130cdc510547196d418d6699d1b46b84a6ddf7c;hb=709370b2198e09f1dbe195fe8813602a3125b7f6;hp=af6e0e1abe840946a8754e426ca93bd653545ca5;hpb=497fb9e21f45ec08e1486abaee6dfa7b20b8a691;p=python_utils.git diff --git a/thread_utils.py b/thread_utils.py index af6e0e1..0130cdc 100644 --- a/thread_utils.py +++ b/thread_utils.py @@ -6,6 +6,9 @@ import os import threading from typing import Callable, Optional, Tuple +# This module is commonly used by others in here and should avoid +# taking any unnecessary dependencies back on them. + logger = logging.getLogger(__name__) @@ -17,6 +20,9 @@ def current_thread_id() -> str: def is_current_thread_main_thread() -> bool: + """Returns True is the current (calling) thread is the process' main + thread and False otherwise. + """ return threading.current_thread() is threading.main_thread()