def join(self, timeout: Optional[float]=None) -> None:
    '\n        Overwrite ``Thread.join`` to make sure server is stopped before\n        joining avoiding a potential deadlock.\n        '
    log.debug('Shutting down server')
    if (not self.is_alive()):
        log.debug('monitor is dead')
        return
    try:
        if (self.loop is not None):
            asyncio.run_coroutine_threadsafe(self.__stop_server(), self.loop)
    except RuntimeError:
        log.exception('Could not close loop')
    self.loop_is_closed.wait(timeout=5)
    if (not self.loop_is_closed.is_set()):
        raise RuntimeError('Failed to join loop')
    log.debug('Loop reported closed')
    super().join(timeout=timeout)
    log.debug('Monitor Thread has joined')
Overwrite ``Thread.join`` to make sure server is stopped before
joining avoiding a potential deadlock.
def join(self, timeout: Optional[float]=None) -> None:
    '\n        Overwrite ``Thread.join`` to make sure server is stopped before\n        joining avoiding a potential deadlock.\n        '
    log.debug('Shutting down server')
    if (not self.is_alive()):
        log.debug('monitor is dead')
        return
    try:
        if (self.loop is not None):
            asyncio.run_coroutine_threadsafe(self.__stop_server(), self.loop)
    except RuntimeError:
        log.exception('Could not close loop')
    self.loop_is_closed.wait(timeout=5)
    if (not self.loop_is_closed.is_set()):
        raise RuntimeError('Failed to join loop')
    log.debug('Loop reported closed')
    super().join(timeout=timeout)
    log.debug('Monitor Thread has joined')