def __init__(self, cancellable: CancellableSubprocess, ha_wakeup: Callable[..., None]) -> None:
        """Create a new instance of :class:`AsyncExecutor`.

        Configure the given *cancellable* and *ha_wakeup*, initializes the control attributes, and instantiate the lock
        and event objects that are used to access attributes and manage communication between threads.

        :param cancellable: a subprocess that supports being cancelled.
        :param ha_wakeup: function to wake up the HA loop.
        """
        self._cancellable = cancellable
        self._ha_wakeup = ha_wakeup
        self._thread_lock = RLock()
        self._scheduled_action: Optional[str] = None
        self._scheduled_action_lock = RLock()
        self._is_cancelled = False
        self._finish_event = Event()
        self.critical_task = CriticalTask()
Create a new instance of :class:`AsyncExecutor`.

        Configure the given *cancellable* and *ha_wakeup*, initializes the control attributes, and instantiate the lock
        and event objects that are used to access attributes and manage communication between threads.

        :param cancellable: a subprocess that supports being cancelled.
        :param ha_wakeup: function to wake up the HA loop.
        
patroni/async_executor.py