def __start_thread(self):
        """
        Starts a new thread, if possible
        """
        with self.__lock:
            if self.__nb_threads >= self._max_threads:
                # Can't create more threads
                return False

            if self._done_event.is_set():
                # We're stopped: do nothing
                return False

            # Prepare thread and start it
            name = "{0}-{1}".format(self._logger.name, self._thread_id)
            self._thread_id += 1

            thread = threading.Thread(target=self.__run, name=name)
            thread.daemon = True
            try:
                self.__nb_threads += 1
                thread.start()
                self._threads.append(thread)
                return True
            except (RuntimeError, OSError):
                self.__nb_threads -= 1
                return False
def __start_thread ( self ) : with self . __lock : if self . __nb_threads >= self . _max_threads : return False if self . _done_event . is_set ( ) : return False name = "{0}-{1}" . format ( self . _logger . name , self . _thread_id ) self . _thread_id += 1 thread = threading . Thread ( target = self . __run , name = name ) thread . daemon = True try : self . __nb_threads += 1 thread . start ( ) self . _threads . append ( thread ) return True except ( RuntimeError , OSError ) : self . __nb_threads -= 1 return False
Starts a new thread, if possible