Folks,

Looking at app_manager.py, I see:

    def stop(self):
        if self.main_thread:
            hub.kill(self.main_thread)
        self.is_active = False
        self._send_event(self._event_stop, None)
        hub.joinall(self.threads)

and I also see:

    def _event_loop(self):
        while self.is_active or not self.events.empty():
            ev = state = None
            try:
                ev, state = self.events.get(timeout=self._event_get_timeout)
            except hub.QueueEmpty:
                continue
            if (ev is None) or (ev == self._event_stop):
                continue
            handlers = self.get_handlers(ev, state)
            for handler in handlers:
                handler(ev)

If the main_thread is kill()ed, setting is_active appears to have no effect.
Similarly, queuing self._event_stop makes no sense either, as the _event_loop() 
should no longer be running to consume and propagate it.

Am I missing something obvious?

Finally - my last question of semantics:
Presuming that the main_thread were *not* killed in stop(), and is_active is 
set to False, it would appear that the _event_loop would not actually stop 
until all queued events had been consumed (thus satisfying is_active == False 
and self.events.empty == True in the condition for the while loop).

Was the original intent for all events to be consumed before stop() would 
function, or was the original intent for stop() to propagate one last event 
(_event_stop), and then exit the loop?

Best,
Victor
--
Victor J. Orlikowski <> vjo@[cs.]duke.edu


------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to