Rejoin the server thread.

        Parameters
        ----------
        timeout : float or None, optional
            Time in seconds to wait for the thread to finish.
177679
def join(self, timeout=None):
        
        self._server.join(timeout)
        if self._handler_thread:
            self._handler_thread.join(timeout)
959975
def wait(
        self, timeout: Union[int, float] = None, safe: bool = False
    ) -> List[Union[Any, Exception]]:
        
        return self.process_list.wait(timeout, safe)
451538
def wait(self, timeout):
    

    with self._condition:
      previous_iteration = self._iteration
      self._condition.wait(timeout)
      return previous_iteration != self._iteration
1052630
def service_timeouts(self):
        
        queue = self._queue
        if self._new_timers:
            new_timers = self._new_timers
            while new_timers:
                heappush(queue, new_timers.pop())

        if queue:
            now = time.time()
            while queue:
                try:
                    timer = queue[0][1]
                    if timer.finish(now):
                        heappop(queue)
                    else:
                        return timer.end
                except Exception:
                    log.exception("Exception while servicing timeout callback: ")
1190264
def revive(self, timeout=None):
        
        if timeout is not None:
            self.timeout = timeout

        self.revive_event.set()
216517
public void waitDone() throws ResponseTimeoutException,
            InvalidResponseException {
        lock.lock();
        try {
            if (!isDoneResponse()) {
                try {
                    condition.await(timeout, TimeUnit.MILLISECONDS);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw new RuntimeException("Interrupted");
                }
            }
            
            if (illegalResponseException != null) {
                throw illegalResponseException;
            }
            
            if (!isDoneResponse()) {
                throw new ResponseTimeoutException("No response after " + timeout
                        + " millis");
            }
        } finally {
            lock.unlock();
        }
    }
1200191
def _wait(self, generator, method, timeout=None, *args, **kwargs):
        """"""
        if self.debug:
            print("waiting for %s to pause" % generator)

        original_timeout = timeout
        while timeout is None or timeout > 0:
            last_time = time.time()
            if self._lock.acquire(False):  # timeout param was added in 3.2
                try:
                    if self.can_resume():
                        return method(generator, *args, **kwargs)
                    elif self.has_terminated():
                        raise RuntimeError("%s has already terminated" % generator)
                finally:
                    self._lock.release()

            if timeout is not None:
                timeout -= time.time() - last_time

        msg = "%s did not pause after %ss" % (generator, original_timeout)
        if self.debug:
            print(msg)
        raise WaitTimeoutError(msg)
649880
public void waitEnd(final long... timeout) {

        long start = System.currentTimeMillis();
        if (timeout.length == 1) {
            start += timeout[0];
        } else {
            start += DEFAULT_TIME_OUT;
        }

        while (!this.hasRun.get()) {
            try {
                Thread.sleep(SLEEP_TIME);
            } catch (final InterruptedException e) {
                break;
            }
            if (System.currentTimeMillis() > start) {
                break; // Break the loop after 1s to avoid freezing the thread
            }
        }

    }
899421
def settimeout(self, timeout):
        
        if timeout is not None:
            timeout = float(timeout)
        self._timeout = timeout
687133
public void joinThread(long timeout)
    {
        // take local ref copy, so can reliably check if ref is null,
        Thread local_thread_ref = thread;
        if (local_thread_ref != null)
        {
            try 
            {
                long millis = 0l;
                if (log.isDebugEnabled())
                {
                    log.debug("BackgroundProcess.joinThread() Waiting " + timeout + " millis for " + this + " to finish");
                    millis = System.currentTimeMillis();
                }
                if (thread_pool != null)
                {
                    synchronized (pool_mutex)
                    {
                        pool_mutex.wait(timeout);
                    }
                }
                else
                    local_thread_ref.join(timeout);

                if (log.isDebugEnabled())
                {
                    millis = System.currentTimeMillis() - millis;
                    log.debug("BackgroundProcess.joinThread() Process " + this + " finished in " + millis + " millis");
                }
            } 
            catch (InterruptedException e) 
            {
                if (log.isDebugEnabled())
                    log.debug("BackgroundProcess.joinThread() Timed out waiting " + timeout + " millis for " + this + " to finish");
            }
        }
        else
        {
            if (log.isDebugEnabled())
                log.debug("BackgroundProcess.joinThread() " + name + " was not running, thread was null");
        }
    }
1028581
def close(self, timeout: int = 5) -> None:
        
        if self._read_task is not None and not self._read_task.cancelled():
            self._read_task.cancel()

        return super().close(timeout)
681514
def wait_until_exit(self):
        

        if self._timeout is None:
            raise Exception("Thread will never exit. Use stop or specify timeout when starting it!")

        self._thread.join()
        self.stop()
393594
def _timeout(self, timeout, handler, *args, **kw):
        
        t = spawn_thread(target=handler, args=args, kw=kw)
        t.daemon = True
        t.start()
        t.join(timeout)

        if not t.is_alive():
            if t.exc_info:
                return t.exc_info
            return t.result
        else:
            try:
                msg = '[%s] Execution was forcefully terminated'
                raise RuntimeError(msg % t.name)
            except:
                return sys.exc_info()
394625
private synchronized void cleanupThread ( long timeout ) throws TransportException {
        Thread t = this.thread;
        if ( t != null && Thread.currentThread() != t ) {
            this.thread = null;
            try {
                log.debug("Interrupting transport thread");
                t.interrupt();
                log.debug("Joining transport thread");
                t.join(timeout);
                log.debug("Joined transport thread");
            }
            catch ( InterruptedException e ) {
                throw new TransportException("Failed to join transport thread", e);
            }
        }
        else if ( t != null ) {
            this.thread = null;
        }
    }
720572
def start(self, timeout=None):
        
        if self._running.isSet():
            raise RuntimeError('Server already started')
        self._stopped.clear()
        # Make sure we have an ioloop
        self.ioloop = self._ioloop_manager.get_ioloop()
        self._ioloop_manager.start()
        # Set max_buffer_size to ensure streams are closed
        # if too-large messages are received
        self._tcp_server = tornado.tcpserver.TCPServer(
            self.ioloop, max_buffer_size=self.MAX_MSG_SIZE)
        self._tcp_server.handle_stream = self._handle_stream
        self._server_sock = self._bind_socket(self._bindaddr)
        self._bindaddr = self._server_sock.getsockname()

        self.ioloop.add_callback(self._install)
        if timeout:
            return self._running.wait(timeout)
1089490
def join(self, timeout=None):
        """"""
        if not self._ioloop_managed:
            # Do nothing if the loop is not managed
            return
        try:
            self._ioloop_thread.join(timeout)
        except AttributeError:
            raise RuntimeError('Cannot join if not started')
668380
def wait(self, timeout=3):
        

        start = time.time()
        while not self.exists():
            self.poco.sleep_for_polling_interval()
            if time.time() - start > timeout:
                break
        return self