core: allow Router.shutdown() to succeed after exit.

For join_thread():

Exception in thread mitogen.master.join_thread_async:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/dmw/src/mitogen/mitogen/master.py", line 249, in _watch
    watcher.on_join()
  File "/home/dmw/src/mitogen/mitogen/master.py", line 816, in shutdown
    super(Broker, self).shutdown()
  File "/home/dmw/src/mitogen/mitogen/core.py", line 2741, in shutdown
    self.defer(_shutdown)
  File "/home/dmw/src/mitogen/mitogen/core.py", line 2142, in defer
    raise Error(self.broker_shutdown_msg)
Error: An attempt was made to enqueue a message with a Broker that has already exitted. It is likely your program called Broker.shutdown() too early.
issue510
David Wilson 5 years ago
parent 822978520f
commit 5761652e02

@ -2738,7 +2738,8 @@ class Broker(object):
_v and LOG.debug('%r.shutdown()', self)
def _shutdown():
self._alive = False
self.defer(_shutdown)
if self._alive and not self._exitted:
self.defer(_shutdown)
def join(self):
"""

Loading…
Cancel
Save