(self, event)
Fall back handler for the :class:`~.events.GenerateEvents` event.

        When the queue is empty a GenerateEvents event is fired, here
        we sleep for as long as possible to avoid using extra cpu cycles.

        A poller would override this with a higher priority handler.
        e.g: ``@handler("generate_events", priority=0)``
        and provide a different way to idle when the queue is empty.
Fall back handler for the :class:`~.events.GenerateEvents` event.
Fall back handler for the : class : ~ . events . GenerateEvents event .
def _on_generate_events(self, event):
        """
        Fall back handler for the :class:`~.events.GenerateEvents` event.

        When the queue is empty a GenerateEvents event is fired, here
        we sleep for as long as possible to avoid using extra cpu cycles.

        A poller would override this with a higher priority handler.
        e.g: ``@handler("generate_events", priority=0)``
        and provide a different way to idle when the queue is empty.
        """

        with event.lock:
            if event.time_left == 0:
                event.stop()
            self._continue.clear()

        if event.time_left > 0:
            # If we get here, there is no component with work to be
            # done and no new event. But some component has requested
            # to be checked again after a certain timeout.
            self._continue.wait(event.time_left)
            # Either time is over or _continue has been set, which
            # implies resume has been called, which means that
            # reduce_time_left(0) has been called. So calling this
            # here is OK in any case.
            event.reduce_time_left(0)
            event.stop()

        while event.time_left < 0:
            # If we get here, there was no work left to do when creating
            # the GenerateEvents event and there is no other handler that
            # is prepared to supply new events within a limited time. The
            # application will continue only if some other Thread fires
            # an event.
            #
            # Python ignores signals when waiting without timeout.
            self._continue.wait(10000)

        event.stop()
def _on_generate_events ( self , event ) : with event . lock : if event . time_left == 0 : event . stop ( ) self . _continue . clear ( ) if event . time_left > 0 : # If we get here, there is no component with work to be # done and no new event. But some component has requested # to be checked again after a certain timeout. self . _continue . wait ( event . time_left ) # Either time is over or _continue has been set, which # implies resume has been called, which means that # reduce_time_left(0) has been called. So calling this # here is OK in any case. event . reduce_time_left ( 0 ) event . stop ( ) while event . time_left < 0 : # If we get here, there was no work left to do when creating # the GenerateEvents event and there is no other handler that # is prepared to supply new events within a limited time. The # application will continue only if some other Thread fires # an event. # # Python ignores signals when waiting without timeout. self . _continue . wait ( 10000 ) event . stop ( )