a_sync.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:a_sync 作者: notion 项目源码 文件源码
def __init__(self, on_exit: ExitOption=ExitOption.ABANDON) -> None:
        """
        Init the state.

        Args:
            on_exit:  determines the behavior on exit when the executor is used as a context manager
                ExitOption.ABANDON:  this is the default.  All remaining threads are abandoned.
                ExitOption.NO_WAIT:   shuts down without waiting for remaining threads to complete.
                ExitOption.WAIT:     shuts down and waits for remaining threads to complete.  This is the
                    default behavior for a vanilla `futures.Executor`, but not for `ThreadExecutor`.

        Returns:  None
        Raises:  None
        Required Tests:  None
        """
        # shared state
        self._monitored_threads = {}  # type: dict
        self._monitor_thread = None  # type: Optional[threading.Thread]
        # lock for ^
        self._monitored_thread_lock = threading.RLock()
        # main thread state
        self._is_shutdown = False
        self._abandon = False
        self._on_exit = on_exit
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号