Exemple #1
0
    def run(self):
        """Spawns a new thread.

        Splits the main program into two threads, one that runs the polling loop
        which updates the client list, and one which gets the data.

        Raises:
            NameError: Raised if the polling thread already exists.
        """

        if not self._thread is None:
            raise NameError("Polling thread already started")

        self._doloop[0] = True
        self._thread = threading.Thread(target=self._poll_loop, name="poll_" + self.name)
        self._thread.daemon = True
        self._thread.start()
        softexit.register_function(self.softexit)
        softexit.register_thread(self._thread, self._doloop)
Exemple #2
0
    def run(self):
        """Spawns a new thread.

        Splits the main program into two threads, one that runs the polling loop
        which updates the client list, and one which gets the data.

        Raises:
            NameError: Raised if the polling thread already exists.
        """

        if not self._thread is None:
            raise NameError("Polling thread already started")

        self._doloop[0] = True
        self._thread = threading.Thread(target=self._poll_loop, name="poll_" + self.name)
        self._thread.daemon = True
        self._thread.start()
        softexit.register_function(self.softexit)
        softexit.register_thread(self._thread, self._doloop)